<?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>22720</bug_id>
          
          <creation_ts>2013-07-18 02:45:55 +0000</creation_ts>
          <short_desc>Components should use &quot;lifetime events&quot; rather than &quot;lifetime callbacks&quot;</short_desc>
          <delta_ts>2013-07-18 20:11:55 +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>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>14968</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Jan Kuča">jan</reporter>
          <assigned_to name="Dimitri Glazkov">dglazkov</assigned_to>
          <cc>dominicc</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>90910</commentid>
    <comment_count>0</comment_count>
    <who name="Jan Kuča">jan</who>
    <bug_when>2013-07-18 02:45:55 +0000</bug_when>
    <thetext>The proposed lifecycle callbacks are awkward when one compares them to other JS components which dispatch native events.

The usual approach to callbacks is that the component instance is an `EventTarget` and events are dispatched as `target.dispatchEvent(e)`. As an alternative, there can be event handler callback functions assigned to the `EventTarget` instance. For example, if there is the `READY` event, the `Element` (being an `EventTarget`) fires &apos;ready&apos; events that can be listened for via listener callback functions added as `element.addEventListener(type, listener)` or via event handlers added as `element.onready = handler`

It does not make any sense (at least to me) to introduce a new way of doing callbacks when there are two ways implemented throughout the whole DOM (and other places).

The proposed callbacks should be converted to events as:
- readyCallback -&gt; READY, &apos;ready&apos;, onready (or should it be rather CREATE?)
- insertedCallback -&gt; INSERT, &apos;insert&apos;, oninsert
- removedCallback -&gt; REMOVE, &apos;remove&apos;, onremove

This also allows for a seamless integration with existing libraries such as jQuery, Google Closure Library and others.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90911</commentid>
    <comment_count>1</comment_count>
    <who name="Dominic Cooney">dominicc</who>
    <bug_when>2013-07-18 05:36:43 +0000</bug_when>
    <thetext>I think the intended use of these callbacks and DOM events are different. These callbacks are used by the implementation of the custom element. The created callback is like a constructor, for example.

If a particular custom element wants to turn around and dispatch an event in response to one of these callbacks, it can do it. I think the integration with existing libraries will come at that level. The custom element translates the raw, low-level callbacks into some more meaningful, higher-level events that make sense for that particular element.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90941</commentid>
    <comment_count>2</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2013-07-18 20:05:41 +0000</bug_when>
    <thetext>Right. Custom element callbacks are at a lower primitive level, compared to events. Also, event dispatch is an incredibly expensive process, and we certainly don&apos;t want the repeat of the mutation events. BTW, this has been discussed ad nauseam on public-webapps (like on this thread here: http://lists.w3.org/Archives/Public/public-webapps/2013JanMar/0790.html).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90943</commentid>
    <comment_count>3</comment_count>
    <who name="Jan Kuča">jan</who>
    <bug_when>2013-07-18 20:11:55 +0000</bug_when>
    <thetext>Oh, now I understand. That is reasonable.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>