W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2013

Re: [webcomponents]: Building HTML elements with custom elements

From: Jonas Sicking <jonas@sicking.cc>
Date: Wed, 20 Feb 2013 20:36:32 -0800
Message-ID: <CA+c2ei9r3CM_U5SuC_2eAVwrQup3MAFpa2u3DZRN5t929Oq3RA@mail.gmail.com>
To: Dimitri Glazkov <dglazkov@chromium.org>
Cc: Alex Russell <slightlyoff@chromium.org>, Erik Arvidsson <arv@chromium.org>, Anne van Kesteren <annevk@annevk.nl>, public-webapps <public-webapps@w3.org>, Boris Zbarsky <bzbarsky@mit.edu>
On Feb 19, 2013 3:54 PM, "Dimitri Glazkov" <dglazkov@chromium.org> wrote:
> 2) Custom element constructor runs at the time of parsing HTML, as the
> tree is constructed.
> PROBLEM: Several implementers let me know that allowing to run JS
> while parsing HTML is not something they can accommodate in a
> reasonable timeframe.
> COMPROMISE: Turn constructor into a callback, which runs in a
> microtask at some later time (like upon encountering </script>).
> COST:  Constructing an element when building a tree != createElement.
> Also, there's an observable difference between the callback and the
> constructor. Since the constructor runs before element is inserted
> into a tree, it will not have any children or the parent. At the time
> the callback is invoked, the element will already be in the tree--and
> thus have children and the parent.

Another cost is that when these elements will exist and be reachable from
script before their constructor runs.

In particular they wont always have had their constructor callback run when
the constructor callback of other elements in the same subtree runs.

/ Jonas
Received on Thursday, 21 February 2013 04:36:59 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:13:58 UTC