From: John Resig Date: Mon, 7 Dec 2009 01:47:41 +0000 (-0800) Subject: Use the getText utility function provided by Sizzle. X-Git-Url: http://git.asbjorn.biz/?p=jquery.git;a=commitdiff_plain;h=3f7fc25494988ee5be66c0af0d552b24f0ca1b79 Use the getText utility function provided by Sizzle. --- diff --git a/src/manipulation.js b/src/manipulation.js index 9103111..a8cb484 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -36,20 +36,7 @@ jQuery.fn.extend({ return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); } - var ret = ""; - - 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; + return jQuery.getText( this ); }, wrapAll: function( html ) { diff --git a/src/sizzle-jquery.js b/src/sizzle-jquery.js index 6f2c86f..3d15128 100644 --- a/src/sizzle-jquery.js +++ b/src/sizzle-jquery.js @@ -2,5 +2,6 @@ jQuery.find = Sizzle; jQuery.expr = Sizzle.selectors; jQuery.expr[":"] = jQuery.expr.filters; jQuery.unique = Sizzle.uniqueSort; +jQuery.getText = getText; return;