diff options
author | John Resig <jeresig@gmail.com> | 2007-07-30 02:14:06 +0000 |
---|---|---|
committer | John Resig <jeresig@gmail.com> | 2007-07-30 02:14:06 +0000 |
commit | 334462b23c3daca53f2fbff177693f0f1ba29c48 (patch) | |
tree | a3b1124262045e8762901e78d62aca57e0e26bab /src/jquery/jquery.js | |
parent | d8e9f0c616402ed1b4dab244ff5f8680ed0a415f (diff) | |
download | jquery-334462b23c3daca53f2fbff177693f0f1ba29c48.tar.gz jquery-334462b23c3daca53f2fbff177693f0f1ba29c48.zip |
IE prunes whitespace from the start of innerHTML-injected strings. This fixes that.
Diffstat (limited to 'src/jquery/jquery.js')
-rw-r--r-- | src/jquery/jquery.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index 705a5bb9c..a0a200993 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -1587,7 +1587,11 @@ jQuery.extend({ for ( var n = tb.length-1; n >= 0 ; --n ) if ( jQuery.nodeName(tb[n], "tbody") && !tb[n].childNodes.length ) tb[n].parentNode.removeChild(tb[n]); - + + // IE completely kills leading whitespace when innerHTML is used + if ( /^\s/.test(arg) ) + div.insertBefore( doc.createTextNode( arg.match(/^\s*/)[0] ), div.firstChild ); + } arg = jQuery.makeArray( div.childNodes ); |