Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#12346 – fn.append not working correctly
// 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 = "&amp;";
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
You can’t perform that action at this time.