<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>28330</bug_id>
          
          <creation_ts>2015-03-25 03:36:13 +0000</creation_ts>
          <short_desc>replace a child with node gets mutation record wrong when node is a DocumentFragment</short_desc>
          <delta_ts>2015-05-08 08:37:48 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>DOM</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Chris Paris">cap</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>cap</cc>
    
    <cc>mike</cc>
    
    <cc>www-dom</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>118923</commentid>
    <comment_count>0</comment_count>
    <who name="Chris Paris">cap</who>
    <bug_when>2015-03-25 03:36:13 +0000</bug_when>
    <thetext>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&apos;s children if node is a DocumentFragment node, and a list containing solely node otherwise.

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

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

Perhaps &quot;let nodes be&quot; should come before &quot;insert node into parent.&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>120229</commentid>
    <comment_count>1</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-05-08 08:37:48 +0000</bug_when>
    <thetext>https://github.com/whatwg/dom/commit/1b9e2f9765884460410d1396dbba99951eafe838</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>