Side navigation
#11291 closed bug (fixed)
Opened February 06, 2012 07:18PM UTC
Closed February 10, 2012 01:51AM UTC
Last modified February 10, 2012 01:59AM UTC
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.
Attachments (0)
Change History (6)
Changed February 06, 2012 07:24PM UTC by comment:1
Changed February 06, 2012 09:02PM UTC by comment:2
Changed February 06, 2012 09:18PM UTC by comment:3
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.
Changed February 06, 2012 09:40PM UTC by comment:4
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.
Changed February 10, 2012 01:51AM UTC by comment:5
resolution: | → fixed |
---|---|
status: | open → closed |
Fix #11291. Always clone XML docs with a genuine .cloneNode().
Changeset: bf7a4df22abcea10cf8f97eb31b5fa989fb4daf5
Changed February 10, 2012 01:59AM UTC by comment:6
milestone: | None → 1.7.2 |
---|
This is actually a good argument for the removal of
shimCloneNode
andcreateSafeFragment