Re: More Ideas around DOM Constructors

Hi everyone,


> [snip]
>
>> 1) Extend createElement(), createElementNS() with a new argument.
>> This new argument should be a name-value map of attributes.  In JS
>> this would look like:
>>
>> createElement("circle", {cx: 40, cy:40, r:20, fill:"red"})
>>
>> As before, this returns the element, which you could then
>> appendChild/insertBefore, etc.
>
> I really like this idea. To me, this feels more like a single event to
> create an element. When I do
>
>   createElement( "circle" )
>
> I feel like I've got a "not quite an object". It's not really created
> until I make a bunch of set calls.

Well mentioned! :-)

This probably would also lead to a good performance boost for DOM2
Mutation Events use-cases, as the object and most or all of its
attributes could then throw a single (?) event. Of course that
arguably a small user base uses it, due to current lack of
cross-implementation support, but still a potential improvement... :-)


Cheers,
  Helder


[1] http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-eventgroupings-mutationevents

Received on Saturday, 21 November 2009 11:40:29 UTC