RESOLVED FIXED 42021
isEqualNode should work for DocumentType nodes
https://bugs.webkit.org/show_bug.cgi?id=42021
Summary isEqualNode should work for DocumentType nodes
Sam Weinig
Reported 2010-07-10 00:17:55 PDT
isEqualNode is implemented incorrectly for DocumentType nodes. According to DOM3, it supposed to check the publicId, systemId, internalSubset, entities and notations are equal.
Attachments
Patch (6.77 KB, patch)
2010-07-10 00:19 PDT, Sam Weinig
andersca: review+
Sam Weinig
Comment 1 2010-07-10 00:19:21 PDT
Andreas Kling
Comment 2 2010-07-10 08:10:50 PDT
Comment on attachment 61143 [details] Patch >WebCore/dom/Node.cpp:1795 > + NamedNodeMap* othereEntities = documentTypeOther->entities(); Variable name should be 'otherEntities' >WebCore/dom/Node.cpp:1798 > + if (entities && entities->mapsEquivalent(othereEntities)) > + return false; This looks wrong. Shouldn't it be "if (entities && !entities->mapsEquivalent(othereEntities))"? Same two comments for the 'notations' section below.
Sam Weinig
Comment 3 2010-07-10 14:27:05 PDT
(In reply to comment #2) > (From update of attachment 61143 [details]) > >WebCore/dom/Node.cpp:1795 > > + NamedNodeMap* othereEntities = documentTypeOther->entities(); > Variable name should be 'otherEntities' > > >WebCore/dom/Node.cpp:1798 > > + if (entities && entities->mapsEquivalent(othereEntities)) > > + return false; > This looks wrong. Shouldn't it be "if (entities && !entities->mapsEquivalent(othereEntities))"? > > Same two comments for the 'notations' section below. Thanks, I made these changes locally. Unfortunately these two bits are not testable at the moment.
Sam Weinig
Comment 4 2010-07-10 14:39:01 PDT
Darin Adler
Comment 5 2010-07-10 15:19:09 PDT
Comment on attachment 61143 [details] Patch Typos: othereEntities and othereNotations. Does mapsEquavalent handle an argument of 0 and return false? Those test cases don't seem to cover all the branches in that function.
Sam Weinig
Comment 6 2010-07-10 15:29:13 PDT
(In reply to comment #5) > (From update of attachment 61143 [details]) > Typos: othereEntities and othereNotations. Does mapsEquavalent handle an argument of 0 and return false? Those test cases don't seem to cover all the branches in that function. mapsEquavalent does handle a null map. I can't currently test the entities, notations or internalSubset branches as those can't currently be set to anything other than the default (null or the null string) in WebCore. I left in the tests since this is not a hot function but I could remove them if you think that would be better.
Alexey Proskuryakov
Comment 7 2010-07-11 09:12:27 PDT
*** Bug 38786 has been marked as a duplicate of this bug. ***
Lucas Forschler
Comment 8 2019-02-06 09:04:03 PST
Mass moving XML DOM bugs to the "DOM" Component.
Note You need to log in before you can comment on or make changes to this bug.