Re: Defining a constructor for Element and friends

On 1/13/15 1:33 PM, Ryosuke Niwa wrote:
> Shouldn't we throw in this case because the concert type of "somename" is HTMLUnknownElement?

Oh, hmm.

Yes, I guess so.  That's very non-obvious to an author.

Even less obvious because for some tag names using the HTMLElement 
constructor is in fact correct.

The end result here is really something that ends up all self-consistent 
and preserving our invariants and the obvious reaction to it will be 
"WAT?".  Not least because the actual interface used by various HTML 
elements is pretty random.

Want a <basefont>?  HTMLElement.  Want a <bgsound>?  HTMLUnknownElement. 
  Want a <rb>?  HTMLUnknownElement.  Want a <big>?  HTMLElement...

> I think if we threw an exception on every attempt to create an element with a name without "-" (as they're HTMLUnknownElement anyway)

I'm not sure I follow.  How do you propose an <s> be constructed via 
constructor, say?  What about <address>?

-Boris

Received on Tuesday, 13 January 2015 19:32:00 UTC