Created
February 2, 2011 01:38
-
-
Save jitter/807092 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery.fn.textFast = function(text) { | |
if (jQuery.isFunction(text)) { | |
return this.each(function(i) { | |
var self = jQuery(this); | |
self.text(text.call(this, i, self.text())); | |
}); | |
} | |
if (typeof text !== "object" && text !== undefined) { | |
return this.empty().append((this[0] && this[0].ownerDocument || document).createTextNode(text)); | |
} | |
return jQuery.textFast(this); | |
}; | |
jQuery.textFast = function(elems) { | |
var ret = "", | |
elem; | |
for (var i = 0; elems[i]; i++) { | |
elem = elems[i]; | |
// this part is new. | |
ret += elem.textContent || elem.innerText || jQuery.text( elem.childNodes ); //to fix a scoping issue in IE6 with Sizzle.getText(elem.childNodes); | |
} | |
return ret; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment