This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 24866 - [Custom]: Consider adding inserted/removed callback
Summary: [Custom]: Consider adding inserted/removed callback
Status: RESOLVED MOVED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - Component Model (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Dimitri Glazkov
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 14968
  Show dependency treegraph
 
Reported: 2014-02-28 18:23 UTC by Dimitri Glazkov
Modified: 2015-07-06 08:06 UTC (History)
6 users (show)

See Also:


Attachments

Description Dimitri Glazkov 2014-02-28 18:23:40 UTC
These will be mapped exactly to inserted/removed hooks in DOM core:

* http://dom.spec.whatwg.org/#node-is-inserted
* http://dom.spec.whatwg.org/#node-is-removed

Based on discussion in bug 24314, we could even deprecate attached/detached callback in their favor.
Comment 1 Scott Miles 2014-02-28 19:03:17 UTC
It's definitely appealing to expose DOM core with high fidelity, but we have some performance realities that concern me.

In particular, calling back into JS from the native side is known to expensive (at least on some platforms).

The currently spec'd callback is only called when an element's subtree is attached or detached form the main document, which is a much lower frequency situation. 

This is less powerful, but it is perhaps a good tradeoff to avoid killing custom elements with expensive callbacks?
Comment 2 Anne 2014-03-17 12:18:02 UTC
Note that the callbacks in DOM need to be updated to take several arguments to provide context for what actually happened. I haven't attempted that rewrite yet.
Comment 3 Hayato Ito 2015-07-06 08:06:11 UTC
Moved to https://github.com/w3c/webcomponents/issues/222