Opened 12 years ago
Closed 10 years ago
#9960 closed bug (fixed)
Append function not working for parent nodes that are nodeType === 9
Reported by: | 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.
Change History (10)
comment:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
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!
comment:3 Changed 12 years ago by
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.
comment:4 Changed 12 years ago by
Update: removed the xml helper and using parseXml at http://jsfiddle.net/FranPregernik/ZVMeq/15/
comment:5 Changed 11 years ago by
Component: | unfiled → manipulation |
---|---|
Milestone: | None → 1.next |
Priority: | undecided → low |
comment:7 Changed 10 years ago by
Owner: | set to mikesherov |
---|---|
Status: | open → assigned |
comment:8 Changed 10 years ago by
Owner: | changed from mikesherov to coopersemantics |
---|
comment:10 Changed 10 years ago by
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