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

@John - in my opinion, <template bindtotagname="my-yay"> is the wrong
direction. You should be declaring which *template* an *element* uses, not
which element a template captures. Having templates latch onto element
types from afar breaks the one-to-many case, prevents sane swapping of
templates on a specific element node, and many other oddities.
Alternatively, <element template="id-of-some-template"> is more flexible
and the right 'direction' for such an association that suffers none of
those issues, at least in my opinion. Feel free to disagree or set me
straight if anything I said is not accurate :)


On Wed, Apr 10, 2013 at 3:21 PM, John J Barton
<johnjbarton@johnjbarton.com>wrote:

>
>
>
> 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:31:12 UTC