Patch for validation of characters in names
David Faure
dfaure at trolltech.com
Tue Jun 24 16:27:47 CEST 2003
The one thing I wasn't too sure about, the cloneNode() fix, was obviously wrong.
It crashed when m_prefix was 0.
The relevant part of the diff, fixed for this problem, would look like this then:
Is the ref() correct?
--- dom_elementimpl.cpp 3 Feb 2003 01:20:24 -0000 1.170.2.1
+++ dom_elementimpl.cpp 24 Jun 2003 13:21:58 -0000
@@ -258,10 +258,14 @@ void ElementImpl::setAttributeMap( Named
NodeImpl *ElementImpl::cloneNode(bool deep)
{
- // ### we loose the namespace here ... FIXME
- ElementImpl *clone = getDocument()->createElement(tagName());
+ ElementImpl *clone = getDocument()->createElement(tagName(), 0);
if (!clone) return 0;
+ // clone prefix (namespace)
+ clone->m_prefix = m_prefix;
+ if ( clone->m_prefix )
+ clone->m_prefix->ref();
+
// clone attributes
if(namedAttrMap)
*(static_cast<NamedAttrMapImpl*>(clone->attributes())) = *namedAttrMap;
@@ -527,10 +537,11 @@ DOMString XMLElementImpl::localName() co
NodeImpl *XMLElementImpl::cloneNode ( bool deep )
{
- // ### we loose namespace here FIXME
- // should pass id around
- XMLElementImpl *clone = new XMLElementImpl(docPtr(), getDocument()->tagName(m_id).implementation());
- clone->m_id = m_id;
+ XMLElementImpl *clone = new XMLElementImpl(docPtr(), m_id);
+ // clone prefix (namespace)
+ clone->m_prefix = m_prefix;
+ if ( clone->m_prefix )
+ clone->m_prefix->ref();
// clone attributes
if(namedAttrMap)
--
David FAURE, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
Qtella users - stability patches at http://blackie.dk/~dfaure/qtella.html
More information about the Khtml-devel
mailing list