Commit 3f7fc254 authored by John Resig's avatar John Resig

Use the getText utility function provided by Sizzle.

parent 20927891
...@@ -36,20 +36,7 @@ jQuery.fn.extend({ ...@@ -36,20 +36,7 @@ jQuery.fn.extend({
return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
} }
var ret = ""; return jQuery.getText( this );
jQuery.each( this, function() {
// Get the text from text nodes and CDATA nodes
if ( this.nodeType === 3 || this.nodeType === 4 ) {
ret += this.nodeValue;
// Traverse everything else, except comment nodes
} else if ( this.nodeType !== 8 ) {
ret += jQuery.fn.text.call( this.childNodes );
}
});
return ret;
}, },
wrapAll: function( html ) { wrapAll: function( html ) {
......
...@@ -2,5 +2,6 @@ jQuery.find = Sizzle; ...@@ -2,5 +2,6 @@ jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors; jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.filters; jQuery.expr[":"] = jQuery.expr.filters;
jQuery.unique = Sizzle.uniqueSort; jQuery.unique = Sizzle.uniqueSort;
jQuery.getText = getText;
return; return;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment