Bug 9035 - document.evaluate and createNSResolver miss on namespaced elements
Summary: document.evaluate and createNSResolver miss on namespaced elements
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 420+
Hardware: Mac (PowerPC) OS X 10.4
: P2 Minor
Assignee: Anders Carlsson
Keywords: HasReduction
Depends on:
Blocks: 10489 7788
  Show dependency treegraph
Reported: 2006-05-22 02:23 PDT by Paul Everitt
Modified: 2019-02-06 09:02 PST (History)
1 user (show)

See Also:

createNSResolver test case (852 bytes, text/html)
2006-05-22 02:25 PDT, Paul Everitt
no flags Details
Patch (13.65 KB, patch)
2006-06-03 10:08 PDT, Anders Carlsson
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Everitt 2006-05-22 02:23:28 PDT
I am using the nightly builds to gain JS access to XPath selection of nodes.  In the test case I create an XHTML2 using a string in JS and calling the DOMParser.  To match on namespaced elements, I create a resolver with xmldoc.createNSResolver and pass it into the xmldoc.evaluate call.

Unfortunately the XPath selection matches nothing in WebKit.  It works in Firefox.
Comment 1 Paul Everitt 2006-05-22 02:25:13 PDT
Created attachment 8457 [details]
createNSResolver test case

A test case with HTML and JS that works in Firefox but fails in the WebKit nightly from May 20 2006.
Comment 2 Anders Carlsson 2006-06-03 10:08:05 PDT
Created attachment 8680 [details]
Comment 3 Darin Adler 2006-06-03 12:47:54 PDT
Comment on attachment 8680 [details]

-Step::Step(AxisType axis, const String& nodeTest, const Vector<Predicate*>& predicates)
+Step::Step(AxisType axis, const String& nodeTest, const Vector<Predicate*> &predicates)

The above is not a good change.

+    Parser *parser = Parser::current();

We put the * next to the type.

+    if (!parser->m_currentNamespaceURI.isNull()) {
+        m_namespaceURI = parser->m_currentNamespaceURI;
+        parser->m_currentNamespaceURI = String();
+    }

Why the if here? Seems that check should be omitted.

+            $$ = new String($1->deprecatedString().mid(colon + 1));

This could use String::substring and then you would not need to bother with the conversion to/from DeprecatedString.

Comment 4 Darin Adler 2006-06-03 18:58:43 PDT
I got an idea:

-    if (m_nodeSetPosition + 1 >= m_nodeSet.size())
+    if (m_nodeSetPosition + 1 > m_nodeSet.size())

This could also be fixed by removing the +1 and keeping the =.
Comment 5 Paul Everitt 2006-06-04 11:19:16 PDT
I just tried the test case in the most recent nightly and it now passes.  Thanks Anders!
Comment 6 Lucas Forschler 2019-02-06 09:02:33 PST
Mass moving XML DOM bugs to the "DOM" Component.