Re: [webcomponents]: Platonic form of custom elements declarative syntax

On Wed, Apr 10, 2013 at 2:56 PM, Scott Miles <sjmiles@google.com> wrote:

> >  how that specific script tag knows what its "this" value is
>

Isn't the precedent:

<template bindtotagname="my-yay">
    <script>
        onBind() {
          this.register(ExactSyntaxTBD);
        }
    <script>
    <shadowroot>
        <div onbind="onBind()">Yay!</div>
    </shadowroot>
</template>

That is, the whole point of the script is to modularize the JS + HTML
right?  Even better is something like
<template bindtotagname="my-yay">
    <script>
       class MyYay {
         constructor() {
          // |this| is the dark div
          this.register(ExactSyntaxTBD);  // sry if this makes no sense...
         }
       }
    <script>
    <shadowroot>
        <div onbind="new MyYay()">Yay!</div>
    </shadowroot>
</template>

In case you want to be inspired, I suggest taking a quick look at this
awesome and related code:

https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/WebCore/bindings/v8/V8LazyEventListener.cpp&q=v8lazy&sq=package:chromium&l=138

jjb

Received on Wednesday, 10 April 2013 22:22:13 UTC