On Wed, Apr 10, 2013 at 6: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);
> }
>
Surely you didn't mean to write it this way? Concise MethodDefinition* *can
only appear as PropertyDefinition or a ClassElement ;)
<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...
> }
> }
>
Of everything that's been presented so far, this is the only approach that
actually makes sense—and it's based in reality—Thanks John!
Rick
<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
>
>