<?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>20490</bug_id>
          
          <creation_ts>2012-12-22 00:36:43 +0000</creation_ts>
          <short_desc>[Custom]: Things that mutate the DOM tree should queue observer records</short_desc>
          <delta_ts>2013-02-20 19:04:18 +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>HISTORICAL - Component Model</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>21063</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>17103</blocked>
    
    <blocked>20684</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Boris Zbarsky">bzbarsky</reporter>
          <assigned_to name="Dimitri Glazkov">dglazkov</assigned_to>
          <cc>bugs</cc>
    
    <cc>wchen</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>80518</commentid>
    <comment_count>0</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2012-12-22 00:36:43 +0000</bug_when>
    <thetext>&quot;The element upgrade algorithm must not queue any observer records. &quot;

This isn&apos;t a reasonable requirement, because it makes mutation observers unreliable.  The requirement should in fact be the other way: any DOM mutations MUST queue observer records.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81488</commentid>
    <comment_count>1</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2013-01-16 17:52:17 +0000</bug_when>
    <thetext>There&apos;s been a similar discussion on bug 20397, starting with comment https://www.w3.org/Bugs/Public/show_bug.cgi?id=20397#c7</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81491</commentid>
    <comment_count>2</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2013-01-16 18:24:58 +0000</bug_when>
    <thetext>I honestly just hate the whole http://parkour.mtv/webcomponents/spec/custom/index.html#dfn-element-upgrade, because it&apos;s very disruptive and unintuitive to a developer. Even less intuitive if we don&apos;t suppress mutation observers. &quot;WTF just happened? I didn&apos;t do that!&quot; would be a very common reaction to capturing some of those records.

I wonder if the www-dom discussion (http://lists.w3.org/Archives/Public/www-dom/2013JanMar/0075.html) will result in a specified behavior where a wrapper is exchanged for another one. Maybe we could piggyback to that behavior and swap wrappers (well, and prototypes in this case) instead doing a whole-hog renameNode?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81492</commentid>
    <comment_count>3</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2013-01-16 18:34:28 +0000</bug_when>
    <thetext>MutationObservers must be reliable. One needs to be able to detect
all the changes to DOM just using an observer so that the current state of DOM
can be inspected using MutationRecords.
Otherwise the whole MutationObserver API is rather useless.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81494</commentid>
    <comment_count>4</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2013-01-16 18:37:47 +0000</bug_when>
    <thetext>Switching wrappers won&apos;t change your localName, right?  Does the current upgrade stuff do that?  The text at https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/custom/index.html#dfn-custom-element-instantiation is completely silent on the question of what the actual DOM node created is like (e.g. its namespace, localName, attributes, etc, etc)...

(As a side note, the first link in comment 2 is to some private network, looks like.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81495</commentid>
    <comment_count>5</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2013-01-16 18:46:28 +0000</bug_when>
    <thetext>(In reply to comment #4)
&gt; Switching wrappers won&apos;t change your localName, right?  Does the current
&gt; upgrade stuff do that?  The text at
&gt; https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/custom/index.html#dfn-
&gt; custom-element-instantiation is completely silent on the question of what
&gt; the actual DOM node created is like (e.g. its namespace, localName,
&gt; attributes, etc, etc)...

They will have identical localName. I need to firm the spec up on that (as you pointed out in bug 20489), but that&apos;s the intent.

And the algo does copy all of the attributes.

&gt; 
&gt; (As a side note, the first link in comment 2 is to some private network,
&gt; looks like.)

Haha. That&apos;s my machine, sorry :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81496</commentid>
    <comment_count>6</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2013-01-16 18:48:44 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; MutationObservers must be reliable. One needs to be able to detect
&gt; all the changes to DOM just using an observer so that the current state of
&gt; DOM
&gt; can be inspected using MutationRecords.
&gt; Otherwise the whole MutationObserver API is rather useless.

The thing is, element upgrade is not something I _want_ the author to observe,   the whole point of the operation is to substitute one DOM node for another with as few side effects as possible.

That&apos;s why just switching wrappers seems better.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81497</commentid>
    <comment_count>7</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2013-01-16 19:01:27 +0000</bug_when>
    <thetext>I don&apos;t quite understand how wrapper switching would help.
well, I&apos;m not sure what you mean with wrapper switching.
Just
tmp = NodeA-&gt;JSWrapper;
NodeA-&gt;JSWrapper = NodeB-&gt;JSWrapper;
NodeB-&gt;JSWrapper = tmp;
?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83415</commentid>
    <comment_count>8</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2013-02-20 19:04:18 +0000</bug_when>
    <thetext>Pouring this over to bug 21063.

*** This bug has been marked as a duplicate of bug 21063 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>