#10501 closed bug (fixed)
HTML5 element "innerShiv" inconsistent across html()/append()
Reported by: | Rick Waldron | Owned by: | Rick Waldron |
---|---|---|---|
Priority: | blocker | Milestone: | 1.7 |
Component: | manipulation | Version: | 1.7b2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Thanks to JD Bartlett for finding this issue. Running this example: http://jsbin.com/obomec in <= IE8 will fail to set style on the newly created section
element, however changing the code to use the html() method instead of append() will work correctly ( http://jsbin.com/obomec/5 )
Change History (14)
comment:1 Changed 12 years ago by
Component: | unfiled → manipulation |
---|---|
Milestone: | None → 1.7 |
Owner: | set to Rick Waldron |
Priority: | undecided → blocker |
Status: | new → assigned |
comment:2 Changed 12 years ago by
comment:3 Changed 12 years ago by
Jonathan Neal's Shimprove tackles the cloneNode issue: http://www.iecss.com/shimprove/
Shimprove overrides cloneNode with newCloneNode -- a method that grabs an element's outerHTML, creates a new element from that HTML within the context of a shim'd fragment, and then returns that element as its result. Badabing badaboom.
Obviously, jQuery shouldn't override any core browser functions, but internal use of a method similar to newCloneNode (on IE's where it's necessary) would fix this issue.
comment:5 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Landing pull request 550. IE6,7,8 cannot use cached fragments from unknown elems. Fixes #10501.
More Details:
comment:6 Changed 12 years ago by
Is the clone() issue fixed in stable jQuery 1.7? I still get <:section></:section> on cloned <section>s in IE8.
comment:7 Changed 12 years ago by
We never go back and change a file once it's released. The current code is always at http://code.jquery.com/jquery-git.js so test against that. We will be releasing 1.7.1 soon.
comment:8 Changed 12 years ago by
Also, for future reference, posting the same question on two tickets is unnecessary.
comment:10 Changed 12 years ago by
Wait. jquery-git.js fixes the issue on .cloneNode() but *not* for .innerHtml() which for Ajax loaded HTML5 content screws all up in IE8: http://pastebin.com/Y4GLa8Tc
comment:11 Changed 11 years ago by
I'm using 1.7.1 and I still get this bug when I try to do something like $('<some selector>').append($('<some selector to html5>'.clone(true)); in the IE8?
comment:12 follow-up: 13 Changed 11 years ago by
I have a better example of the inconsistencies that are still occurring. http://jsfiddle.net/jjgMC/11/
It's impossible right now to use $.html() on elements that are not in the DOM, you must use $.append() in those cases.
comment:13 Changed 11 years ago by
Replying to drew@…:
I have a better example of the inconsistencies that are still occurring. http://jsfiddle.net/jjgMC/11/
It's impossible right now to use $.html() on elements that are not in the DOM, you must use $.append() in those cases.
Also version http://jsfiddle.net/jjgMC/12/ shows that jquery-git(as of 1/11/2012) also fails to correctly allow styles (but they all work in FF9/Webkit/IE9)
comment:14 Changed 11 years ago by
jQuery's HTML5 support is not intended to be a "fix-all", Please be sure to use the latest "html5shiv":
http://code.google.com/p/html5shiv/
See: http://jsbin.com/egumes/2
Running in IE8:
Seems to be an issue with IE<=8's Element#cloneNode. cloneNode is used by jQuery.clone, which is used by jQuery#domManip, which is used by jQuery.append.
When there are styles targeting a class associated with the HTML5 element being cloned, IE8 seems to act appropriately: http://jsbin.com/obomec/2