Skip to content

Commit

Permalink
Update comments in growl/unorphan.
Browse files Browse the repository at this point in the history
  • Loading branch information
rstacruz committed Nov 12, 2012
1 parent 5147fd2 commit 3af6c52
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
3 changes: 3 additions & 0 deletions growl/jquery.growl.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/*! jQuery.growl (c) 2010-12, Rico Sta. Cruz. MIT License.
* http://github.com/rstacruz/jquery-stuff/tree/master/growl */

// Usage:
//
// $.growl("Message");
Expand Down
33 changes: 17 additions & 16 deletions unorphan/jquery.unorphan.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
/*! ---------------------------------------
* Unorphan
* http://github.com/rstacruz/jquery-stuff
* ---------------------------------------- */
/*! Unorphan (c) 2012, Rico Sta. Cruz. MIT License.
* http://github.com/rstacruz/jquery-stuff/tree/master/unorphan */

$.fn.unorphan = function() {
$(this).each(function() {
var last = this.lastChild;
(function($) {
$.fn.unorphan = function() {
$(this).each(function() {
var last = this.lastChild;

if ((last) && (last.nodeType == 3)) {
var text = last.nodeValue;
var stripped = text.replace(/^\s*|\s*$/g, ' ');
var spaces = stripped.match(/ /g).length;
if ((last) && (last.nodeType == 3)) {
var text = last.nodeValue;
var stripped = text.replace(/^\s*|\s*$/g, ' ');
var spaces = stripped.match(/ /g).length;

if (spaces > 0) {
last.nodeValue = last.nodeValue.replace(/\s*([^\s]+\s*)$/g, '\xA0$1');
if (spaces > 0) {
last.nodeValue = last.nodeValue.replace(/\s*([^\s]+\s*)$/g, '\xA0$1');
}
}
}
});
};
});
return this;
};
})(jQuery);

0 comments on commit 3af6c52

Please sign in to comment.