<?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>22565</bug_id>
          
          <creation_ts>2013-07-03 22:31:12 +0000</creation_ts>
          <short_desc>[Custom]: rename inserted/removedCallback to entered/leftDocumentCallback</short_desc>
          <delta_ts>2013-08-29 21:50:05 +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>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>
          
          <blocked>14968</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Dimitri Glazkov">dglazkov</reporter>
          <assigned_to name="Dimitri Glazkov">dglazkov</assigned_to>
          <cc>annevk</cc>
    
    <cc>danieljb2</cc>
    
    <cc>dfreedm</cc>
    
    <cc>dominicc</cc>
    
    <cc>mrbkap</cc>
    
    <cc>sjmiles</cc>
    
    <cc>sorvell</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>90278</commentid>
    <comment_count>0</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2013-07-03 22:31:12 +0000</bug_when>
    <thetext>The inserted/removed aren&apos;t as precise in describing the reason they&apos;re called, which is when the custom element enters or leaves the document.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90689</commentid>
    <comment_count>1</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-07-12 22:11:07 +0000</bug_when>
    <thetext>That&apos;s called insert and remove by the DOM though and its various methods.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90698</commentid>
    <comment_count>2</comment_count>
    <who name="Daniel Buchner">danieljb2</who>
    <bug_when>2013-07-13 04:24:02 +0000</bug_when>
    <thetext>(In reply to comment #0)
&gt; The inserted/removed aren&apos;t as precise in describing the reason they&apos;re
&gt; called, which is when the custom element enters or leaves the document.

I agree with Anne, developers are more likely to recognize these actions as &apos;inserted&apos; and &apos;removed&apos; - remove(), removeChild(), insertBefore(), DOM Level 3 Mutation Event legacy, etc. I would rather see the API use method names that mirror what developers are already thinking and are instantly recognizable, than ones that are excessively descriptive and obtuse.

In addition, are entered/leftDocument really correct? What happens when I move a node by reference that is already in the DOM to another place in the DOM? For example:

  &lt;ul&gt;
    &lt;li id=&quot;one&quot;&gt;&lt;/li&gt;
    &lt;li id=&quot;two&quot;&gt;&lt;/li&gt;
    &lt;li id=&quot;three&quot;&gt;&lt;/li&gt;
  &lt;/ul&gt;

  var one = document.getElementById(&apos;one&apos;),
      three = document.getElementById(&apos;three&apos;);

  one.parentNode.insertBefore(one, three);

Does &apos;one&apos; ever leave the document before insertion above &apos;three&apos;? Further, even if it _technically_ does, would everyday developers actually be aware of such a nuance?

All this goes to the point that while enter/left may be a bit more technically correct (assuming it is still so in the above case - albeit briefly), developers are conditioned (for various reasons) to associate this behavior with inserted/removed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90699</commentid>
    <comment_count>3</comment_count>
    <who name="Scott Miles">sjmiles</who>
    <bug_when>2013-07-13 05:02:29 +0000</bug_when>
    <thetext>The problem is that I can compose a zillion nodes into a big tree and none of them are &apos;inserted&apos; until the root of that tree hits the document.

IOW, what triggers this event is not necessarily any direct action or change to the node itself. It does not reflect the state of &apos;parentNode&apos; which is what developers actually seem to expect from &apos;inserted&apos; and &apos;removed&apos;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92589</commentid>
    <comment_count>4</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2013-08-26 18:26:36 +0000</bug_when>
    <thetext>What do you guys think about enteredView/leftView? The thing is, these callbacks are only called on documents that have browsing context (and thus a non-null defaultView property).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92590</commentid>
    <comment_count>5</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2013-08-26 18:33:11 +0000</bug_when>
    <thetext>https://dvcs.w3.org/hg/webcomponents/rev/3d4a6a4e4a3d, but will keep the bug open to hear reactions to enteredView/leftView idea.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92591</commentid>
    <comment_count>6</comment_count>
    <who name="Scott Miles">sjmiles</who>
    <bug_when>2013-08-26 18:35:11 +0000</bug_when>
    <thetext>I agree that the suffix `document` is confusing, since we mean a specific document (I usually think of it as window.document, but it sounds like &apos;document with defaultView&apos; is more precise).

From that standpoint, suffix &apos;view&apos; seems to me an improvement.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92592</commentid>
    <comment_count>7</comment_count>
    <who name="Daniel Freedman">dfreedm</who>
    <bug_when>2013-08-26 18:36:10 +0000</bug_when>
    <thetext>As long it&apos;s well explained that *View is not related to &quot;element is in the visible rect on screen&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92714</commentid>
    <comment_count>8</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2013-08-29 21:50:05 +0000</bug_when>
    <thetext>https://dvcs.w3.org/hg/webcomponents/rev/91083383c13c</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>