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

Re: Defining a constructor for Element and friends

From: Ryosuke Niwa <rniwa@apple.com>
Date: Tue, 13 Jan 2015 11:42:45 -0800
Cc: Domenic Denicola <d@domenic.me>, Anne van Kesteren <annevk@annevk.nl>, WebApps WG <public-webapps@w3.org>, "www-dom@w3.org" <www-dom@w3.org>
Message-id: <1997521D-F95D-42C2-839D-7FBC3E2D8D40@apple.com>
To: Boris Zbarsky <bzbarsky@mit.edu>

On Jan 13, 2015, at 11:31 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:

> 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…

Indeed the developer ergonomics here is terrible :(

>> 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>?

Sorry, I meant that only non-standard (i.e. unknown) HTML elements.  If we're disallowing upgrades as we've been arguing, then we should probably disallow HTMLUnknownElements altogether regardless of whether they contain "-" in their names or not.

- R. Niwa
Received on Tuesday, 13 January 2015 19:43:36 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:27:25 UTC