W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2011

Re: [DOM4]: Element.create

From: Charles Pritchard <chuck@jumis.com>
Date: Thu, 15 Sep 2011 11:26:46 -0700
Message-ID: <4E724366.2010009@jumis.com>
To: Anne van Kesteren <annevk@opera.com>
CC: www-dom@w3.org
On 9/15/2011 11:17 AM, Anne van Kesteren wrote:
> On Thu, 15 Sep 2011 20:07:51 +0200, Charles Pritchard 
> <chuck@jumis.com> wrote:
>> On webapps, we discussed a helper method, "create", which might fit 
>> well in DOM4.
>> http://lists.w3.org/Archives/Public/public-webapps/2011JulSep/0707.html
>> Element.create('img', {src: '...'}),
> I'm not sure what the second argument should be in terms of Web IDL. 
> It's basically an unconstrained dictionary, but we do not have that at 
> the moment.
> It's also unclear to me whether the second argument should set 
> properties or attributes. Setting attributes would be consistent with 
> the DOM model. Setting properties might be more convenient, but e.g. 
> setting innerHTML complicates matters as there is also a third 
> argument to Element.create to conveniently set children.

My two thoughts:

data-* and aria-* are special cases of element.setAttribute(key, value),
others would be the same as element[key] = value;

Attributes and properties should always be processed before children.
Received on Thursday, 15 September 2011 18:27:05 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:18 UTC