Patch for removeAttributeNode
Peter Kelly
pmk at kde.org
Sun Jun 29 11:00:32 CEST 2003
On Sat, 28 Jun 2003, David Faure wrote:
> On Saturday 28 June 2003 03:52, Dirk Mueller wrote:
> > On Fre, 27 Jun 2003, David Faure wrote:
> >
> > > (The "false" doesn't matter, it's ignored). AFAICS this doesn't introduce a memleak
> >
> > it doesn't introduce a memory leak, but its still wrong. why cloning the
> > attribute node? it should return the old node, not a clone of it :)
> >
> > The real question is why value is suddenly becoming null..
>
> That's quite obvious:
>
> if (attr->_value) {
> attr->_value->deref();
> attr->_value = 0;
> if (element)
> element->parseAttribute(attr);
> }
>
> at the end of NamedAttrMapImpl::removeAttribute().
>
> Since this modifies "attr", I need a clone of it, one with the value still set...
removeNamedItem() is supposed to return the item removed, not a clone.
i.e. you should be able to do the following:
attr = document.createAttribute("align");
elem.setAttribute(attr);
a = elem.removeNamedItem("align");
then (attr == a) should be true.
To notify the element of the attribute value becoming null you could
temporarily set it to null and then back again before returning the
attribute.
>
>
--
Peter Kelly
pmk at kde.org
More information about the Khtml-devel
mailing list