#11291 closed bug (fixed)
Cloning XMLDoc's with HTML5 nodeName's breaks on IE
Reported by: | adebree | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | 1.7.2 |
Component: | manipulation | Version: | 1.7.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
For example:
var xmlStr = "<root><meter /></root>"; var xmlDoc = jQuery.parseXML( xmlStr ); var $xmlDoc = jQuery( xmlDoc ); var $meter = $xmlDoc.find( "meter" ).clone();
Due to "meter" being in the list of HTML5 nodeNames jQuery incorrectly uses the shimCloneNode() function for cloning. This results in $meter being a textNode (nodeType 3) and having the data 'undefined'.
And since the regex to detect the node names is only checking the start of the node name this also causes problems for elements in a HTMLDoc like <metering />
Patch is already done, will place a pull request.
Change History (6)
comment:1 Changed 11 years ago by
comment:3 Changed 11 years ago by
Component: | unfiled → manipulation |
---|---|
Priority: | undecided → low |
Status: | new → open |
This is valid, but please provide a test case on http://jsfiddle.net to demonstrate the issue in this ticket.
@rwaldron: I think jQuery should be able to work without html5shim.
comment:4 Changed 11 years ago by
jsfiddle for this bug:
Run in IE8 or lower and the nodeType will be 3 instead of the expected 1 showing the clone() does not properly take place.
comment:5 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | open → closed |
Fix #11291. Always clone XML docs with a genuine .cloneNode().
Changeset: bf7a4df22abcea10cf8f97eb31b5fa989fb4daf5
comment:6 Changed 11 years ago by
Milestone: | None → 1.7.2 |
---|
This is actually a good argument for the removal of
shimCloneNode
andcreateSafeFragment