2 * This file is part of the DOM implementation for KDE.
4 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
5 * (C) 1999 Antti Koivisto (koivisto@kde.org)
6 * (C) 2001 Peter Kelly (pmk@post.com)
7 * (C) 2001 Dirk Mueller (mueller@kde.org)
8 * Copyright (C) 2004 Apple Computer, Inc.
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Library General Public
12 * License as published by the Free Software Foundation; either
13 * version 2 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Library General Public License for more details.
20 * You should have received a copy of the GNU Library General Public License
21 * along with this library; see the file COPYING.LIB. If not, write to
22 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 * Boston, MA 02111-1307, USA.
27 #include "dom/dom_exception.h"
28 #include "dom/dom_node.h"
29 #include "xml/dom_textimpl.h"
30 #include "xml/dom_docimpl.h"
31 #include "xml/dom2_eventsimpl.h"
32 #include "xml/dom_elementimpl.h"
34 #include "khtml_part.h"
37 #include "html/htmlparser.h"
39 #include "rendering/render_canvas.h"
40 #include "misc/htmlhashes.h"
41 #include "css/css_valueimpl.h"
42 #include "css/css_stylesheetimpl.h"
43 #include "css/cssstyleselector.h"
44 #include "xml/dom_xmlimpl.h"
46 #include <qtextstream.h>
50 using namespace khtml;
52 AttributeImpl* AttributeImpl::clone(bool) const
54 AttributeImpl* result = new AttributeImpl(m_id, _value);
55 result->setPrefix(_prefix);
59 void AttributeImpl::allocateImpl(ElementImpl* e) {
60 _impl = new AttrImpl(e, e->docPtr(), this);
63 AttrImpl::AttrImpl(ElementImpl* element, DocumentPtr* docPtr, AttributeImpl* a)
64 : NodeBaseImpl(docPtr),
68 assert(!m_attribute->_impl);
69 m_attribute->_impl = this;
76 assert(m_attribute->_impl == this);
77 m_attribute->_impl = 0;
81 DOMString AttrImpl::nodeName() const
83 return getDocument()->attrName(m_attribute->id());
86 unsigned short AttrImpl::nodeType() const
88 return Node::ATTRIBUTE_NODE;
91 DOMString AttrImpl::prefix() const
93 return m_attribute->prefix();
96 void AttrImpl::setPrefix(const DOMString &_prefix, int &exceptioncode )
98 checkSetPrefix(_prefix, exceptioncode);
102 m_attribute->setPrefix(_prefix.implementation());
105 DOMString AttrImpl::nodeValue() const {
106 return m_attribute->value();
109 void AttrImpl::setValue( const DOMString &v, int &exceptioncode )
113 // ### according to the DOM docs, we should create an unparsed Text child
115 // do not interprete entities in the string, its literal!
117 // NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly
119 exceptioncode = DOMException::NO_MODIFICATION_ALLOWED_ERR;
123 // ### what to do on 0 ?
125 exceptioncode = DOMException::DOMSTRING_SIZE_ERR;
129 m_attribute->setValue(v.implementation());
131 m_element->attributeChanged(m_attribute);
134 void AttrImpl::setNodeValue( const DOMString &v, int &exceptioncode )
137 // NO_MODIFICATION_ALLOWED_ERR: taken care of by setValue()
138 setValue(v, exceptioncode);
141 NodeImpl *AttrImpl::cloneNode ( bool /*deep*/)
143 return new AttrImpl(0, docPtr(), m_attribute->clone());
147 bool AttrImpl::childAllowed( NodeImpl *newChild )
152 return childTypeAllowed(newChild->nodeType());
155 bool AttrImpl::childTypeAllowed( unsigned short type )
158 case Node::TEXT_NODE:
159 case Node::ENTITY_REFERENCE_NODE:
167 DOMString AttrImpl::toString() const
171 result += nodeName();
173 // FIXME: substitute entities for any instances of " or ' --
174 // maybe easier to just use text value and ignore existing
177 if (firstChild() != NULL) {
180 for (NodeImpl *child = firstChild(); child != NULL; child = child->nextSibling()) {
181 result += child->toString();
190 // -------------------------------------------------------------------------
192 ElementImpl::ElementImpl(DocumentPtr *doc)
199 ElementImpl::~ElementImpl()
202 namedAttrMap->detachFromElement();
203 namedAttrMap->deref();
210 void ElementImpl::removeAttribute( NodeImpl::Id id, int &exceptioncode )
213 namedAttrMap->removeNamedItem(id, exceptioncode);
214 if (exceptioncode == DOMException::NOT_FOUND_ERR) {
220 void ElementImpl::setAttribute(NodeImpl::Id id, const DOMString &value)
222 int exceptioncode = 0;
223 setAttribute(id,value.implementation(),exceptioncode);
226 NamedAttrMapImpl* ElementImpl::attributes(bool readonly) const
228 updateStyleAttributeIfNeeded();
230 if (!readonly && !namedAttrMap) createAttributeMap();
234 unsigned short ElementImpl::nodeType() const
236 return Node::ELEMENT_NODE;
239 const AtomicStringList* ElementImpl::getClassList() const
244 const AtomicString& ElementImpl::getIDAttribute() const
246 return namedAttrMap ? namedAttrMap->id() : nullAtom;
249 const AtomicString& ElementImpl::getAttribute(NodeImpl::Id id) const
251 if (id == ATTR_STYLE)
252 updateStyleAttributeIfNeeded();
255 AttributeImpl* a = namedAttrMap->getAttributeItem(id);
256 if (a) return a->value();
261 const AtomicString& ElementImpl::getAttributeNS(const DOMString &namespaceURI,
262 const DOMString &localName) const
264 NodeImpl::Id id = getDocument()->attrId(namespaceURI.implementation(),
265 localName.implementation(), true);
266 if (!id) return nullAtom;
267 return getAttribute(id);
270 void ElementImpl::setAttribute(NodeImpl::Id id, DOMStringImpl* value, int &exceptioncode )
273 getDocument()->incDOMTreeVersion();
275 // allocate attributemap if necessary
276 AttributeImpl* old = attributes(false)->getAttributeItem(id);
278 // NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly
279 if (namedAttrMap->isReadOnly()) {
280 exceptioncode = DOMException::NO_MODIFICATION_ALLOWED_ERR;
285 updateId(old ? old->value() : nullAtom, value);
289 namedAttrMap->removeAttribute(id);
290 else if (!old && value)
291 namedAttrMap->addAttribute(createAttribute(id, value));
292 else if (old && value) {
293 old->setValue(value);
294 attributeChanged(old);
298 AttributeImpl* ElementImpl::createAttribute(NodeImpl::Id id, DOMStringImpl* value)
300 return new AttributeImpl(id, value);
303 void ElementImpl::setAttributeMap( NamedAttrMapImpl* list )
306 getDocument()->incDOMTreeVersion();
308 // If setting the whole map changes the id attribute, we need to
311 AttributeImpl *oldId = namedAttrMap ? namedAttrMap->getAttributeItem(ATTR_ID) : 0;
312 AttributeImpl *newId = list ? list->getAttributeItem(ATTR_ID) : 0;
314 if (oldId || newId) {
315 updateId(oldId ? oldId->value() : nullAtom, newId ? newId->value() : nullAtom);
319 namedAttrMap->deref();
325 namedAttrMap->element = this;
326 unsigned int len = namedAttrMap->length();
327 for(unsigned int i = 0; i < len; i++)
328 attributeChanged(namedAttrMap->attrs[i]);
332 bool ElementImpl::hasAttributes() const
334 updateStyleAttributeIfNeeded();
336 return namedAttrMap && namedAttrMap->length() > 0;
339 NodeImpl *ElementImpl::cloneNode(bool deep)
341 // ### we lose the namespace here ... FIXME
343 ElementImpl *clone = getDocument()->createElement(tagName(), exceptioncode);
344 if (!clone) return 0;
348 *clone->attributes() = *namedAttrMap;
351 cloneChildNodes(clone);
355 DOMString ElementImpl::nodeName() const
360 DOMString ElementImpl::tagName() const
362 DOMString tn = getDocument()->tagName(id());
365 return DOMString(m_prefix) + ":" + tn;
370 void ElementImpl::setPrefix( const DOMString &_prefix, int &exceptioncode )
372 checkSetPrefix(_prefix, exceptioncode);
378 m_prefix = _prefix.implementation();
383 void ElementImpl::createAttributeMap() const
385 namedAttrMap = new NamedAttrMapImpl(const_cast<ElementImpl*>(this));
389 bool ElementImpl::isURLAttribute(AttributeImpl *attr) const
395 RenderStyle *ElementImpl::styleForRenderer(RenderObject *parentRenderer)
397 return getDocument()->styleSelector()->styleForElement(this);
400 RenderObject *ElementImpl::createRenderer(RenderArena *arena, RenderStyle *style)
402 if (getDocument()->documentElement() == this && style->display() == NONE) {
403 // Ignore display: none on root elements. Force a display of block in that case.
404 RenderBlock* result = new (arena) RenderBlock(this);
405 if (result) result->setStyle(style);
408 return RenderObject::createObject(this, style);
412 void ElementImpl::insertedIntoDocument()
414 // need to do superclass processing first so inDocument() is true
415 // by the time we reach updateId
416 NodeBaseImpl::insertedIntoDocument();
419 NamedAttrMapImpl *attrs = attributes(true);
421 AttributeImpl *idAttr = attrs->getAttributeItem(ATTR_ID);
422 if (idAttr && !idAttr->isNull()) {
423 updateId(nullAtom, idAttr->value());
429 void ElementImpl::removedFromDocument()
432 NamedAttrMapImpl *attrs = attributes(true);
434 AttributeImpl *idAttr = attrs->getAttributeItem(ATTR_ID);
435 if (idAttr && !idAttr->isNull()) {
436 updateId(idAttr->value(), nullAtom);
441 NodeBaseImpl::removedFromDocument();
444 void ElementImpl::attach()
447 createRendererIfNeeded();
449 NodeBaseImpl::attach();
452 void ElementImpl::recalcStyle( StyleChange change )
454 // ### should go away and be done in renderobject
455 RenderStyle* _style = m_render ? m_render->style() : 0;
456 bool hasParentRenderer = parent() ? parent()->renderer() : false;
461 case NoChange: debug = "NoChange";
463 case NoInherit: debug= "NoInherit";
465 case Inherit: debug = "Inherit";
467 case Force: debug = "Force";
470 qDebug("recalcStyle(%d: %s)[%p: %s]", change, debug, this, tagName().string().latin1());
472 if ( hasParentRenderer && (change >= Inherit || changed()) ) {
473 RenderStyle *newStyle = getDocument()->styleSelector()->styleForElement(this);
475 StyleChange ch = diff( _style, newStyle );
477 if (attached()) detach();
478 // ### Suboptimal. Style gets calculated again.
480 // attach recalulates the style for all children. No need to do it twice.
482 setHasChangedChild( false );
483 newStyle->deref(getDocument()->renderArena());
486 else if (ch != NoChange) {
487 if( m_render && newStyle ) {
488 //qDebug("--> setting style on render element bgcolor=%s", newStyle->backgroundColor().name().latin1());
489 m_render->setStyle(newStyle);
492 else if (changed() && m_render && newStyle && (getDocument()->usesSiblingRules() || getDocument()->usesDescendantRules())) {
493 // Although no change occurred, we use the new style so that the cousin style sharing code won't get
494 // fooled into believing this style is the same. This is only necessary if the document actually uses
495 // sibling/descendant rules, since otherwise it isn't possible for ancestor styles to affect sharing of
497 m_render->setStyleInternal(newStyle);
500 newStyle->deref(getDocument()->renderArena());
502 if ( change != Force) {
503 if (getDocument()->usesDescendantRules())
511 for (n = _first; n; n = n->nextSibling()) {
512 //qDebug(" (%p) calling recalcStyle on child %s/%p, change=%d", this, n, n->isElementNode() ? ((ElementImpl *)n)->tagName().string().latin1() : n->isTextNode() ? "text" : "unknown", change );
513 if ( change >= Inherit || n->isTextNode() ||
514 n->hasChangedChild() || n->changed() )
515 n->recalcStyle( change );
519 setHasChangedChild( false );
523 bool ElementImpl::childAllowed( NodeImpl *newChild )
525 if (!childTypeAllowed(newChild->nodeType()))
528 // For XML documents, we are non-validating and do not check against a DTD, even for HTML elements.
529 if (getDocument()->isHTMLDocument())
530 return checkChild(id(), newChild->id());
534 bool ElementImpl::childTypeAllowed( unsigned short type )
537 case Node::ELEMENT_NODE:
538 case Node::TEXT_NODE:
539 case Node::COMMENT_NODE:
540 case Node::PROCESSING_INSTRUCTION_NODE:
541 case Node::CDATA_SECTION_NODE:
542 case Node::ENTITY_REFERENCE_NODE:
550 void ElementImpl::dispatchAttrRemovalEvent(AttributeImpl *attr)
552 if (!getDocument()->hasListenerType(DocumentImpl::DOMATTRMODIFIED_LISTENER))
554 //int exceptioncode = 0;
555 // dispatchEvent(new MutationEventImpl(EventImpl::DOMATTRMODIFIED_EVENT,true,false,attr,attr->value(),
556 // attr->value(), getDocument()->attrName(attr->id()),MutationEvent::REMOVAL),exceptioncode);
559 void ElementImpl::dispatchAttrAdditionEvent(AttributeImpl *attr)
561 if (!getDocument()->hasListenerType(DocumentImpl::DOMATTRMODIFIED_LISTENER))
563 // int exceptioncode = 0;
564 // dispatchEvent(new MutationEventImpl(EventImpl::DOMATTRMODIFIED_EVENT,true,false,attr,attr->value(),
565 // attr->value(),getDocument()->attrName(attr->id()),MutationEvent::ADDITION),exceptioncode);
568 DOMString ElementImpl::openTagStartToString() const
570 DOMString result = DOMString("<") + tagName();
572 NamedAttrMapImpl *attrMap = attributes(true);
575 unsigned long numAttrs = attrMap->length();
576 for (unsigned long i = 0; i < numAttrs; i++) {
579 AttributeImpl *attribute = attrMap->attributeItem(i);
580 AttrImpl *attr = attribute->attrImpl();
583 result += attr->toString();
585 result += getDocument()->attrName(attribute->id());
586 if (!attribute->value().isNull()) {
588 // FIXME: substitute entities for any instances of " or '
589 result += attribute->value();
599 DOMString ElementImpl::toString() const
601 DOMString result = openTagStartToString();
603 if (hasChildNodes()) {
606 for (NodeImpl *child = firstChild(); child != NULL; child = child->nextSibling()) {
607 result += child->toString();
620 void ElementImpl::updateId(const AtomicString& oldId, const AtomicString& newId)
628 DocumentImpl* doc = getDocument();
629 if (!oldId.isEmpty())
630 doc->removeElementById(oldId, this);
631 if (!newId.isEmpty())
632 doc->addElementById(newId, this);
636 void ElementImpl::dump(QTextStream *stream, QString ind) const
638 updateStyleAttributeIfNeeded();
640 for (uint i = 0; i < namedAttrMap->length(); i++) {
641 AttributeImpl *attr = namedAttrMap->attributeItem(i);
642 *stream << " " << DOMString(getDocument()->attrName(attr->id())).string().ascii()
643 << "=\"" << DOMString(attr->value()).string().ascii() << "\"";
647 NodeBaseImpl::dump(stream,ind);
652 void ElementImpl::formatForDebugger(char *buffer, unsigned length) const
658 if (s.length() > 0) {
662 s = getAttribute(ATTR_ID);
663 if (s.length() > 0) {
664 if (result.length() > 0)
670 s = getAttribute(ATTR_CLASS);
671 if (s.length() > 0) {
672 if (result.length() > 0)
678 strncpy(buffer, result.string().latin1(), length - 1);
682 // -------------------------------------------------------------------------
684 XMLElementImpl::XMLElementImpl(DocumentPtr *doc, DOMStringImpl *_tagName)
687 m_id = doc->document()->tagId(0 /* no namespace */, _tagName, false /* allocate */);
690 XMLElementImpl::XMLElementImpl(DocumentPtr *doc, DOMStringImpl *_qualifiedName, DOMStringImpl *_namespaceURI)
694 for (uint i = 0; i < _qualifiedName->l; ++i)
695 if (_qualifiedName->s[i] == ':') {
702 DOMStringImpl* localName = _qualifiedName->copy();
704 localName->remove(0,colonpos+1);
705 m_id = doc->document()->tagId(_namespaceURI, localName, false /* allocate */);
707 m_prefix = _qualifiedName->copy();
709 m_prefix->truncate(colonpos);
713 m_id = doc->document()->tagId(_namespaceURI, _qualifiedName, false /* allocate */);
718 XMLElementImpl::~XMLElementImpl()
722 DOMString XMLElementImpl::localName() const
724 return getDocument()->tagName(m_id);
728 NodeImpl *XMLElementImpl::cloneNode ( bool deep )
730 // ### we loose namespace here FIXME
731 // should pass id around
732 XMLElementImpl *clone = new XMLElementImpl(docPtr(), getDocument()->tagName(m_id).implementation());
737 *clone->attributes() = *namedAttrMap;
740 cloneChildNodes(clone);
745 // -------------------------------------------------------------------------
747 NamedAttrMapImpl::NamedAttrMapImpl(ElementImpl *e)
754 NamedAttrMapImpl::~NamedAttrMapImpl()
756 NamedAttrMapImpl::clearAttributes(); // virtual method, so qualify just to be explicit
759 bool NamedAttrMapImpl::isHTMLAttributeMap() const
764 AttrImpl *NamedAttrMapImpl::getNamedItem ( NodeImpl::Id id ) const
766 AttributeImpl* a = getAttributeItem(id);
770 a->allocateImpl(element);
772 return a->attrImpl();
775 Node NamedAttrMapImpl::setNamedItem ( NodeImpl* arg, int &exceptioncode )
778 exceptioncode = DOMException::NOT_FOUND_ERR;
782 // NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
784 exceptioncode = DOMException::NO_MODIFICATION_ALLOWED_ERR;
788 // WRONG_DOCUMENT_ERR: Raised if arg was created from a different document than the one that created this map.
789 if (arg->getDocument() != element->getDocument()) {
790 exceptioncode = DOMException::WRONG_DOCUMENT_ERR;
794 // Not mentioned in spec: throw a HIERARCHY_REQUEST_ERROR if the user passes in a non-attribute node
795 if (!arg->isAttributeNode()) {
796 exceptioncode = DOMException::HIERARCHY_REQUEST_ERR;
799 AttrImpl *attr = static_cast<AttrImpl*>(arg);
801 AttributeImpl* a = attr->attrImpl();
802 AttributeImpl* old = getAttributeItem(a->id());
803 if (old == a) return arg; // we know about it already
805 // INUSE_ATTRIBUTE_ERR: Raised if arg is an Attr that is already an attribute of another Element object.
806 // The DOM user must explicitly clone Attr nodes to re-use them in other elements.
807 if (attr->ownerElement()) {
808 exceptioncode = DOMException::INUSE_ATTRIBUTE_ERR;
812 if (a->id() == ATTR_ID) {
813 element->updateId(old ? old->value() : nullAtom, a->value());
816 // ### slightly inefficient - resizes attribute array twice.
819 if (!old->attrImpl())
820 old->allocateImpl(element);
822 removeAttribute(a->id());
829 // The DOM2 spec doesn't say that removeAttribute[NS] throws NOT_FOUND_ERR
830 // if the attribute is not found, but at this level we have to throw NOT_FOUND_ERR
831 // because of removeNamedItem, removeNamedItemNS, and removeAttributeNode.
832 Node NamedAttrMapImpl::removeNamedItem ( NodeImpl::Id id, int &exceptioncode )
834 // ### should this really be raised when the attribute to remove isn't there at all?
835 // NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly
837 exceptioncode = DOMException::NO_MODIFICATION_ALLOWED_ERR;
841 AttributeImpl* a = getAttributeItem(id);
843 exceptioncode = DOMException::NOT_FOUND_ERR;
847 if (!a->attrImpl()) a->allocateImpl(element);
848 Node r(a->attrImpl());
851 element->updateId(a->value(), nullAtom);
858 AttrImpl *NamedAttrMapImpl::item ( unsigned long index ) const
863 if (!attrs[index]->attrImpl())
864 attrs[index]->allocateImpl(element);
866 return attrs[index]->attrImpl();
869 AttributeImpl* NamedAttrMapImpl::getAttributeItem(NodeImpl::Id id) const
871 bool matchAnyNamespace = (namespacePart(id) == anyNamespace);
872 for (unsigned long i = 0; i < len; ++i) {
873 if (attrs[i]->id() == id)
875 else if (matchAnyNamespace) {
876 if (localNamePart(attrs[i]->id()) == localNamePart(id))
883 NodeImpl::Id NamedAttrMapImpl::mapId(const DOMString& namespaceURI,
884 const DOMString& localName, bool readonly)
887 if (!element) return 0;
888 return element->getDocument()->attrId(namespaceURI.implementation(),
889 localName.implementation(), readonly);
892 void NamedAttrMapImpl::clearAttributes()
896 for (i = 0; i < len; i++) {
898 attrs[i]->_impl->m_element = 0;
907 void NamedAttrMapImpl::detachFromElement()
909 // we allow a NamedAttrMapImpl w/o an element in case someone still has a reference
910 // to if after the element gets deleted - but the map is now invalid
915 NamedAttrMapImpl& NamedAttrMapImpl::operator=(const NamedAttrMapImpl& other)
917 // clone all attributes in the other map, but attach to our element
918 if (!element) return *this;
920 // If assigning the map changes the id attribute, we need to call
923 AttributeImpl *oldId = getAttributeItem(ATTR_ID);
924 AttributeImpl *newId = other.getAttributeItem(ATTR_ID);
926 if (oldId || newId) {
927 element->updateId(oldId ? oldId->value() : nullAtom, newId ? newId->value() : nullAtom);
932 attrs = new AttributeImpl* [len];
934 // first initialize attrs vector, then call attributeChanged on it
935 // this allows attributeChanged to use getAttribute
936 for (uint i = 0; i < len; i++) {
937 attrs[i] = other.attrs[i]->clone();
941 // FIXME: This is wasteful. The class list could be preserved on a copy, and we
942 // wouldn't have to waste time reparsing the attribute.
943 // The derived class, HTMLNamedAttrMapImpl, which manages a parsed class list for the CLASS attribute,
944 // will update its member variable when parse attribute is called.
945 for(uint i = 0; i < len; i++)
946 element->attributeChanged(attrs[i], true);
951 void NamedAttrMapImpl::addAttribute(AttributeImpl *attr)
953 // Add the attribute to the list
954 AttributeImpl **newAttrs = new AttributeImpl* [len+1];
956 for (uint i = 0; i < len; i++)
957 newAttrs[i] = attrs[i];
964 AttrImpl * const attrImpl = attr->_impl;
966 attrImpl->m_element = element;
968 // Notify the element that the attribute has been added, and dispatch appropriate mutation events
969 // Note that element may be null here if we are called from insertAttr() during parsing
971 element->attributeChanged(attr);
972 element->dispatchAttrAdditionEvent(attr);
973 element->dispatchSubtreeModifiedEvent(false);
977 void NamedAttrMapImpl::removeAttribute(NodeImpl::Id id)
979 unsigned long index = len+1;
980 for (unsigned long i = 0; i < len; ++i)
981 if (attrs[i]->id() == id) {
986 if (index >= len) return;
988 // Remove the attribute from the list
989 AttributeImpl* attr = attrs[index];
990 if (attrs[index]->_impl)
991 attrs[index]->_impl->m_element = 0;
998 AttributeImpl **newAttrs = new AttributeImpl* [len-1];
1000 for (i = 0; i < uint(index); i++)
1001 newAttrs[i] = attrs[i];
1003 for (; i < len; i++)
1004 newAttrs[i] = attrs[i+1];
1009 // Notify the element that the attribute has been removed
1010 // dispatch appropriate mutation events
1011 if (element && !attr->_value.isNull()) {
1012 AtomicString value = attr->_value;
1013 attr->_value = nullAtom;
1014 element->attributeChanged(attr);
1015 attr->_value = value;
1018 element->dispatchAttrRemovalEvent(attr);
1019 element->dispatchSubtreeModifiedEvent(false);