Created
August 28, 2012 07:53
-
-
Save markelog/3495987 to your computer and use it in GitHub Desktop.
#12346 – fn.append not working correctly
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
// In previous versions of jQuery, on every for iteration new div was created in jQuery.clean, | |
// now, on every iteration only one div is used, which created some problems – | |
// Illustration of WebKit bug | |
div = document.createElement("div"); | |
div.innerHTML = "1"; | |
nodes = jQuery.merge( [], div.childNodes ); | |
div.innerHTML = "2"; | |
console.log( nodes[ 0 ].textContent ) // 2 | |
// easially fixable, if before | |
div.innerHTML = "2"; | |
// will be | |
div.innerHTML = ""; | |
// but IE case more complex | |
div.innerHTML = "<span>content</span>"; | |
element = div.childNodes[ 0 ]; | |
div.innerHTML = "something"; | |
console.log( element.textContent ); // empty | |
// same goes for html-entites | |
div.innerHTML = "&"; | |
element = div.childNodes[ 0 ]; | |
div.innerHTML = "something"; | |
console.log( element.textContent ); // Error | |
//but it would be OK if element was removed thorough removeChild method |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment