[webcomponents] [Custom]: Consider adding inserted/removed callback (bugzilla: 24866) (#222)

Title: [Custom]: Consider adding inserted/removed callback (bugzilla: 24866)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24866

----
comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24866#c0
*Dimitri Glazkov* wrote on 2014-02-28 18:23:40 +0000.

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
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24866#c1
*Scott Miles* wrote on 2014-02-28 19:03:17 +0000.

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
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24866#c2
*Anne* wrote on 2014-03-17 12:18:02 +0000.

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.

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/222

Received on Monday, 6 July 2015 07:43:59 UTC