<?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>22966</bug_id>
          
          <creation_ts>2013-08-15 02:47:10 +0000</creation_ts>
          <short_desc>[Custom]: Don&apos;t invoke callbacks while the createdCallback is running</short_desc>
          <delta_ts>2013-08-26 21:58:31 +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>Linux</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="Dominic Cooney">dominicc</reporter>
          <assigned_to name="Dimitri Glazkov">dglazkov</assigned_to>
          <cc>sjmiles</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>92076</commentid>
    <comment_count>0</comment_count>
    <who name="Dominic Cooney">dominicc</who>
    <bug_when>2013-08-15 02:47:10 +0000</bug_when>
    <thetext>The rationale is that the createdCallback is like a constructor and should run to completion before callbacks start firing.

However the callbacks should still be queued (not dropped) while the createdCallback is running, because that is past the point where the prototype has been updated.

For example:

proto.createdCallback = function() {
  console.log(&apos;created start&apos;);
  this.remove();
  this.setAttribute(&apos;foo&apos;, &apos;bar&apos;);
  console.log(&apos;created end&apos;);
};
... (other callbacks which log) ...

should log

created start
created end
entered
left
attribute changed

Maybe the relationship between enqueuing a callback in a callback queue, and moving the callback queue to the top-of-processing stack element queue needs to change. Maybe the spec should model this with an explicit flag (
(&quot;created-callback-ran&quot;). If the flag is not set when enqueuing a callback (other than the created callback and the special-case first entered callback), then the callback queue should not be moved to the top-of-processing-stack. (Of course no callbacks are queued until the created callback has started running, as usual.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92078</commentid>
    <comment_count>1</comment_count>
    <who name="Scott Miles">sjmiles</who>
    <bug_when>2013-08-15 04:22:37 +0000</bug_when>
    <thetext>Thank you for taking this on. You are appreciated for working on rationalizing some of these feature requests!

Seems better to achieve by changing the nature of the queue relationships and not with a flag, but that&apos;s just $0.02 worth.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92092</commentid>
    <comment_count>2</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2013-08-15 15:20:18 +0000</bug_when>
    <thetext>Ok. I&apos;ve been trying to think of a solution that doesn&apos;t involve special treatment of the created callback, but haven&apos;t come up with one.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92125</commentid>
    <comment_count>3</comment_count>
    <who name="Dominic Cooney">dominicc</who>
    <bug_when>2013-08-16 01:54:31 +0000</bug_when>
    <thetext>FWIW Blink implements it this way now, we can get feedback from developers. Anecdotally, the developer of Chrome apps&apos; &lt;webview&gt; thought this was an improvement.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92594</commentid>
    <comment_count>4</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2013-08-26 18:51:39 +0000</bug_when>
    <thetext>Also (from bug 22991):

&gt; - With the exception of the created callback and the magic entered callback,
&gt; callbacks should not be queued until the created callback starts to run.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92603</commentid>
    <comment_count>5</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2013-08-26 21:58:23 +0000</bug_when>
    <thetext>(In reply to comment #4)
&gt; Also (from bug 22991):
&gt; 
&gt; &gt; - With the exception of the created callback and the magic entered callback,
&gt; &gt; callbacks should not be queued until the created callback starts to run.

https://dvcs.w3.org/hg/webcomponents/rev/348757462b1f</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92604</commentid>
    <comment_count>6</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2013-08-26 21:58:31 +0000</bug_when>
    <thetext>https://dvcs.w3.org/hg/webcomponents/rev/4f25aa1b9a4b</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>