WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
30969
A no-prefix XPath node test should not match no-namespace elements in HTML document
https://bugs.webkit.org/show_bug.cgi?id=30969
Summary
A no-prefix XPath node test should not match no-namespace elements in HTML do...
Alexey Proskuryakov
Reported
2009-10-30 16:18:09 PDT
Because it matches elements in the default XHTML namespace, and XHTML now says that this should change, see <
http://www.w3.org/Bugs/Public/show_bug.cgi?id=7059
>.
Attachments
proposed patch
(4.94 KB, patch)
2009-10-30 16:22 PDT
,
Alexey Proskuryakov
darin
: review+
ap
: commit-queue-
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2009-10-30 16:22:22 PDT
Created
attachment 42243
[details]
proposed patch
Darin Adler
Comment 2
2009-10-30 16:26:26 PDT
Comment on
attachment 42243
[details]
proposed patch
> - if (node->isHTMLElement() && node->document()->isHTMLDocument()) { > - // Paths without namespaces should match HTML elements in HTML documents despite those having an XHTML namespace. Names are compared case-insensitively. > - return equalIgnoringCase(static_cast<Element*>(node)->localName(), name) && (namespaceURI.isNull() || namespaceURI == node->namespaceURI()); > + if (node->document()->isHTMLDocument()) { > + if (node->isHTMLElement()) { > + // Paths without namespaces should match HTML elements in HTML documents despite those having an XHTML namespace. Names are compared case-insensitively. > + return equalIgnoringCase(static_cast<Element*>(node)->localName(), name) && (namespaceURI.isNull() || namespaceURI == node->namespaceURI()); > + } else { > + // An expression without any prefix shouldn't match no-namespace nodes (because HTML5 says so). > + return static_cast<Element*>(node)->hasLocalName(name) && namespaceURI == node->namespaceURI() && !namespaceURI.isNull(); > + }
We normally don't do else after return. It would be nice if the test case covered a few more cases than just the bug-fixed one. r=me
Alexey Proskuryakov
Comment 3
2009-10-30 16:30:11 PDT
> It would be nice if the test case covered a few more cases than just the > bug-fixed one.
We've got a number of tests for namespaces in XPath element node tests - these few lines of code have a long history.
Alexey Proskuryakov
Comment 4
2009-11-02 10:42:39 PST
Committed <
http://trac.webkit.org/changeset/50419
>.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug