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

Re: A proposal for Element constructors

From: Cameron McCormack <cam@mcc.id.au>
Date: Wed, 26 Oct 2011 13:33:06 -0700
Message-ID: <4EA86E82.1090606@mcc.id.au>
To: public-webapps@w3.org
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", ...);

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 20:33:38 GMT

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