W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2011

Re: A proposal for Element constructors

From: Rick Waldron <waldron.rick@gmail.com>
Date: Wed, 26 Oct 2011 18:57:37 -0400
Message-ID: <CAHfnhfpXBkZBmtRU46KQ4nO4Gb96zd_FMKtohKEPu4eNUWnDKg@mail.gmail.com>
To: Cameron McCormack <cam@mcc.id.au>
Cc: public-webapps@w3.org
On Wed, Oct 26, 2011 at 4:33 PM, Cameron McCormack <cam@mcc.id.au> wrote:

> On 25/10/11 8:54 PM, Adam Barth wrote:
>
>> Another solution to that "more than one tag per interface" problem is
>> to introduce subclasses of those interfaces for each tag.
>>
>
> Instead of introducing more interfaces (which don't have additional
> functionality), and instead of introducing Element.create, I would rather
> see a pattern like:
>
>  var e = new Element("div", ...);
>

This exists in the Prototype.js lib (
http://api.prototypejs.org/dom/Element/new/) which has seen massive
abandonment in the past 3-4 years.


>
> There is no requirement that the object returned from a constructor be an
> object that has the constructor.prototype as its [[Prototype]], so having
> the above constructor return an HTMLDivElement is fine.
>
> (Also note that the constructor text nodes should be Text rather than
> TextNode, according to the interface name in DOM Core.)
>
>
Received on Wednesday, 26 October 2011 22:58:31 GMT

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