diff options
author | Chris Antaki <ChrisAntaki@gmail.com> | 2013-10-30 01:16:05 -0700 |
---|---|---|
committer | Richard Gibson <richard.gibson@gmail.com> | 2013-11-05 17:13:49 -0500 |
commit | fb2e0a0c2864846af701203d3708da5dab3e6ba2 (patch) | |
tree | 4f6caa6f990358f55a01729a550accbd0c5ad81b /src | |
parent | 19c1b6109a73bc7d0d5bd84587b5c5a44d3e2a74 (diff) | |
download | jquery-fb2e0a0c2864846af701203d3708da5dab3e6ba2.tar.gz jquery-fb2e0a0c2864846af701203d3708da5dab3e6ba2.zip |
Fix #11809: Update text without creating DOM nodes. Close gh-1412.
Diffstat (limited to 'src')
-rw-r--r-- | src/manipulation.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/manipulation.js b/src/manipulation.js index 3de597f0f..738864293 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -314,7 +314,11 @@ jQuery.fn.extend({ return access( this, function( value ) { return value === undefined ? jQuery.text( this ) : - this.empty().append( ( this[ 0 ] && this[ 0 ].ownerDocument || document ).createTextNode( value ) ); + this.empty().each(function() { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + this.textContent = value; + } + }); }, null, value, arguments.length ); }, |