Implementing setAttribute in the way you suggest should be fine.

And, you could read the DOM spec as requiring it, although it is not
completely clear.  It says setAttribute "Adds a new attribute. If an
attribute with that name is already present in the element, its value is
changed to be that of the value parameter."  See
http://www.w3.org/TR/DOM-Level-2/core.html#ID-745549614

If you'd like to go ahead and make the change, mail the patch back to this
list and I'll put it in.

   -- Andy


----- Original Message -----
From: "Steve Dickson" <[EMAIL PROTECTED]>

> In ElementImpl::setAttribute(), a new AttrImpl object is created,
> populated and then inserted into ElementImpl::attributes using
> NamedNodeMapImpl::setNamedItem().   If an item with the same name already
> exists in the NamedNodeMap, it is replaced by the newly created item and
> deleted (pending reference counting).
>
> Wouldn't it be more effective to check whether an attribute of this name
> exists first and, if so, repopulate it with the new data?  Is there some
> compelling reason why the method was not implemented this way?
>


Reply via email to