Side navigation
#9960 closed bug (fixed)
Opened August 03, 2011 01:26PM UTC
Closed November 24, 2012 09:54PM UTC
Append function not working for parent nodes that are nodeType === 9
Reported by: | FranPregernik@googlemail.com | Owned by: | coopersemantics |
---|---|---|---|
Priority: | low | Milestone: | 1.next |
Component: | manipulation | Version: | 1.6.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I encountered this problem while I was trying to replace the root node of an xml with another one. I was using replaceWith which in this case first removes the old one and then
appends the new one to the xml document.
This works id the parent of the node to be replaced is not the XMLDocument (nodeType===9) itself (works for normal element nodes).
I made an test jfiddle for this case:
http://jsfiddle.net/FranPregernik/ZVMeq
The fix is in the test code. You can enable it by uncommenting the append function. Then both tests will pass.
I can't seem to find if this behavior is desired or was the nodeType === 9 just accidentally neglected.
Attachments (0)
Change History (10)
Changed August 03, 2011 01:29PM UTC by comment:1
Changed August 03, 2011 02:21PM UTC by comment:2
status: | new → open |
---|
I think this wasn't found before because in an HTML document it would be unusual to append elements to the document
element. Seems valid for XML though and your patch should do the trick. Many thanks for the clear test case!
Changed August 03, 2011 02:43PM UTC by comment:3
A couple of notes: 1) The test case throws an error in IE7 for the second test. 2) The xml() helper could be replaced with $.parseXML() now but it's fine as-is.
Changed August 04, 2011 09:02AM UTC by comment:4
Update: removed the xml helper and using parseXml at http://jsfiddle.net/FranPregernik/ZVMeq/15/
Changed October 13, 2011 04:13AM UTC by comment:5
component: | unfiled → manipulation |
---|---|
milestone: | None → 1.next |
priority: | undecided → low |
Changed September 05, 2012 02:31AM UTC by comment:7
owner: | → mikesherov |
---|---|
status: | open → assigned |
Changed September 07, 2012 05:22PM UTC by comment:8
owner: | mikesherov → coopersemantics |
---|
Changed September 07, 2012 06:16PM UTC by comment:9
Changed November 24, 2012 09:54PM UTC by comment:10
resolution: | → fixed |
---|---|
status: | assigned → closed |
Fix #9960, allow manipulation for parent document nodes. Close gh-924.
Changeset: 78c1560065e664213ac0cbea7518d442a58b0018
Tested on:
Chrome 13, Firefox 5, IE9