[webcomponents]: Of weird script elements and Benadryl

... or "How the heck do we initialize custom elements in declarative syntax?"

There were good questions raised about the nature of <script> element
in the "platonic form" thread. Consider this syntax:

<element name="foo-bar">
    <script> ...</script>
    <template> ... </template>
</element>

The way <element> should work is like this:
a) when </element> is seen
b) generate a constructor for this element
b) run document.register
c) run initialization code

 As I see it, the problem is twofold:

1) The <script> element timing is weird. Since <script> is
initialization code, it has to run after the </element> is seen. This
is already contrary to a typical <script> element expectations.

2) The <script> element needs a way to refer to the custom element
prototype it is initializing. Enclosing it in a function and calling
it with <element> as |this| seemed like a simplest thing to do, but
Rick and John had allergic reactions and had to be hospitalized.

So far, I haven't seen any other workable alternatives. TC39 peeps and
others, help me find them.

:DG<

Received on Friday, 12 April 2013 19:31:02 UTC