WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
17725
XPath should be case insensitive for HTML
https://bugs.webkit.org/show_bug.cgi?id=17725
Summary
XPath should be case insensitive for HTML
Romuald Brunet
Reported
2008-03-08 09:57:26 PST
It is not necessarily a bug (since XML is case sensitive), but I've found that XPath implementation in Safari differs from some other browsers (Firefox and Opera). For exemple, in a xhtml 1.0 document, retrieving .//IMG won't return anything (either if the tags are uppercase, which is invalid xhtml, or if they are not). You can check the url for a practical example Found this bug because I'm used to use uppercase for tags in CSS selectors. Since this behavior applies in Firefox and Opera, you may choose to change Safari's implementation.
Attachments
proposed fix
(6.61 KB, patch)
2009-05-27 03:34 PDT
,
Alexey Proskuryakov
darin
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2009-05-27 02:59:54 PDT
I don't see any reason to remain incompatible with other engines in this respect, patch forthcoming.
Alexey Proskuryakov
Comment 2
2009-05-27 03:34:16 PDT
Created
attachment 30701
[details]
proposed fix
Darin Adler
Comment 3
2009-05-27 09:29:35 PDT
Comment on
attachment 30701
[details]
proposed fix
> + if (node->nodeType() != Node::ELEMENT_NODE) > + return false;
How about isElementNode() instead?
> + 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()); > + } else > + return static_cast<Element*>(node)->hasLocalName(name) && namespaceURI == node->namespaceURI();
We normally don't do else after return. r=me
Alexey Proskuryakov
Comment 4
2009-05-27 10:22:27 PDT
Committed <
http://trac.webkit.org/changeset/44190
>. (In reply to
comment #3
)
> How about isElementNode() instead?
Node::ELEMENT_NODE is used elsewhere in this file, it seemed good for consistency.
> We normally don't do else after return.
Fixed.
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