This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 28330 - replace a child with node gets mutation record wrong when node is a DocumentFragment
Summary: replace a child with node gets mutation record wrong when node is a DocumentF...
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: DOM (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Anne
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-25 03:36 UTC by Chris Paris
Modified: 2015-05-08 08:37 UTC (History)
3 users (show)

See Also:


Attachments

Description Chris Paris 2015-03-25 03:36:13 UTC
https://dom.spec.whatwg.org/#concept-node-replace

[[
Insert node into parent before reference child with the suppress observers flag set.

Let nodes be node's children if node is a DocumentFragment node, and a list containing solely node otherwise.

Queue a mutation record of "childList" for target parent with addedNodes nodes, removedNodes a list solely containing child, nextSibling reference child, and previousSibling child's previous sibling. 
]]

In the case that the new node is a DocumentFragment, the Insert step removes node's children (per https://dom.spec.whatwg.org/#concept-node-insert, Step 5). Then "let nodes be" is always the empty list, and then the addedNodes in the mutation record is empty.

Perhaps "let nodes be" should come before "insert node into parent."