[Bug 20913] [Custom]: Meaning of prototype in document.register is underspecified

https://www.w3.org/Bugs/Public/show_bug.cgi?id=20913

--- Comment #10 from Erik Arvidsson <arv@chromium.org> ---
(In reply to comment #9)
> Here's the summary:
> 
> Depending on your heritage, you will be instantiated in one of two ways when
> using document.createElement/NS or your constructor.
> 
> 1) If you inherit from an existing HTML or SVG element, you and all your
> descendants will always be instantiated with the "is" syntax.
> 
> 2) If you inherit from HTMLElement or SVGElement, you and your descendants
> will always be instantiated with the custom tag syntax.

That seems like a reasonable trade off.

Then all the following asserts should pass

  class MyButton extends HTMLButtonElement {}
  document.register('my-button', MyButton);

  var b1 = new MyButton()
  assert(b1.tagName === 'button');

  var b2 = document.createElement('my-button');
  assert(b2.tagName === 'button');

  var div = document.createElement('div');
  div.innerHTML = '<my-button>...</my-button>';
  var b3 = div.firstChild;
  assert(b3.tagName === 'button');

It is unfortunate and unexpected but I don't see any other possibility given
the current constraints.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Saturday, 9 February 2013 01:29:33 UTC