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

Re: [webcomponents]: HTMLElementElement missing a primitive

From: Scott Miles <sjmiles@google.com>
Date: Fri, 8 Mar 2013 15:11:59 -0800
Message-ID: <CAHbmOLZbg7Ha=VGWLMas=QH2vjXtEqSKPax16x-gN-XAfFH7Gw@mail.gmail.com>
To: Erik Arvidsson <arv@chromium.org>
Cc: Dimitri Glazkov <dglazkov@chromium.org>, public-webapps <public-webapps@w3.org>
Steve Orvell suggested that one could do

<element name='x-fancier' extends="x-fancy">
<script>
class XFancier extends this.extendee {
  fancify() {
     super();
     makeFancier();
  }
}
 this.register(XFancier);

As long as Element calculates 'extendee' and the registration system can
deal with the full prototype.

It's clever, but not particularly satisfying.

S


On Fri, Mar 8, 2013 at 2:16 PM, Scott Miles <sjmiles@google.com> wrote:

> In a polyfill, it's easy to make them parallel, but I don't know how to do
> that with ES6.
>
> XFancier = Polyfill.Class(XFancy, prototype);
> document.register('x-fancier', XFancier);
>
> and
>
> <element name="XFancier" extends="x-fancy">
> <template> more resources here </template>
> <script>Polyfill.register(this, prototype);</script>
> </element>
>
> I'm assuming use of 'super' in ES6 and some [lesser] form of that
> supported by Polyfill.
>
>
> On Fri, Mar 8, 2013 at 2:09 PM, Scott Miles <sjmiles@google.com> wrote:
>
>>
>> inline
>>
>> On Fri, Mar 8, 2013 at 2:02 PM, Erik Arvidsson <arv@chromium.org> wrote:
>>
>>> Allowing the same information in 2 places is problematic. We could allow
>>> it but then we need to throw if they diverge.
>>>
>>
>> Yes, and it's also just plain annoying to have these variations IMO.
>>
>>
>>>
>>> To back up, the following example is incomplete:
>>>
>>> <element name='x-fancier' extends="x-fancy">
>>> <script>
>>> class XFancier extends XFancy {
>>>   fancify() {
>>>      super(); // How do I get inherited fancify?
>>>      makeFancier();
>>>   }
>>> }
>>>
>>
>> Yes, sorry, there has to be a registration step here, I've been doing
>> this:
>>
>>     this.register(XFancier);
>>
>>
>>> </script>
>>> </element>
>>>
>>> because no one is associating XFancier with x-fancier.
>>>
>>>
>>> On Fri, Mar 8, 2013 at 4:13 PM, Scott Miles <sjmiles@google.com> wrote:
>>>
>>>> But now XFancier carries a complete prototype, and there is no
>>>> 'extends' attribute, which is where I came in. This is my 'option 1'.
>>>>
>>>> Are you suggesting this should be optional? This is why I wanted to
>>>> bring it up.
>>>>
>>>> Scott
>>>>
>>>>
>>>> On Fri, Mar 8, 2013 at 1:03 PM, Erik Arvidsson <arv@chromium.org>wrote:
>>>>
>>>>> Inline...
>>>>>
>>>>> On Fri, Mar 8, 2013 at 3:33 PM, Scott Miles <sjmiles@google.com>wrote:
>>>>>
>>>>>> imperative:
>>>>>>
>>>>>> class XFancier extends XFancy {
>>>>>>   fancify() {
>>>>>>      super();
>>>>>>      makeFancier();
>>>>>>   }
>>>>>> ...
>>>>>> document.register('x-fancier', XFancier);
>>>>>>
>>>>>> declarative:
>>>>>>
>>>>>> <element name='x-fancier' extends="x-fancy">
>>>>>> <script>
>>>>>>   class XFancier {
>>>>>>   fancify() {
>>>>>>      super(); // How do I get inherited fancify?
>>>>>>
>>>>>
>>>>> Yeah, this will not work. super is statically bound.
>>>>>
>>>>> Of course we could dynamically rebind super but not having an extends
>>>>> clause is really confusing.
>>>>>
>>>>> Why can't we just do?
>>>>>
>>>>> <element name="x-fancier">
>>>>> <script>
>>>>> class XFancier extends XFancy {
>>>>>    ...
>>>>> }
>>>>> </script>
>>>>> </element>
>>>>>
>>>>> --
>>>>> erik
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>> erik
>>>
>>>
>>>
>>
>
Received on Friday, 8 March 2013 23:12:35 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:58 GMT