Re: [webcomponents]: Of weird script elements and Benadryl

On 4/15/13 10:45 AM, Rick Waldron wrote:
> Sorry, I should've been more specific. What I meant was that:
>
> new HTMLButtonElement();
>
> Doesn't construct an HTMLButtonElement, it throws with an "illegal
> constructor" in Chrome and "HTMLButtonElement is not a constructor" in
> Firefox (I'm sure this is the same across other browsers)

Oh, I see.  That's not anything inherent, for what it's worth; making 
this particular case work would be <10 lines of code.  Less on a 
per-element basis if we want to do this for most elements.

> function Smile() {
>    HTMLButtonElement.call(this);
>    this.textContent = ":)";
> }
>
> Smile.prototype = Object.create(HTMLButtonElement.prototype);

Ah, so... This would not work even if "new HTMLButtonElement" worked, 
right?  In particular, if HTMLButtonElement were actually something that 
could construct things in Gecko, it would still ignore its argument when 
called and always creates a new object.  You can see the behavior with 
something like XMLHttpRequest if you want.

> Hopefully that clarifies?

Somewhat.  Trying to understand what things we really need to support 
here and in what ways, long-term...

-Boris

Received on Monday, 15 April 2013 16:00:25 UTC