WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED CONFIGURATION CHANGED
87888
XPath expression `//node()` shouldn’t match the DOCTYPE node
https://bugs.webkit.org/show_bug.cgi?id=87888
Summary
XPath expression `//node()` shouldn’t match the DOCTYPE node
Mathias Bynens
Reported
2012-05-30 13:08:55 PDT
Test case: data:text/html,<!DOCTYPE%20html><script>document.write(document.evaluate('%2F%2Fnode()'%2C%20document%2C%20null%2C%20XPathResult.FIRST_ORDERED_NODE_TYPE%2C%20null).singleNodeValue%20%3D%3D%20document.documentElement%20%3F%20'PASS'%20%3A%20'FAIL')<%2Fscript>
Attachments
test case
(199 bytes, text/html)
2012-05-30 14:56 PDT
,
Alexey Proskuryakov
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2012-05-30 14:56:57 PDT
Created
attachment 144929
[details]
test case Same test as attachment, because long URL breaks layout.
Alexey Proskuryakov
Comment 2
2012-05-30 14:59:35 PDT
Could you please explain why this is wrong? I'm not disagreeing with you, it's just not obvious.
Mathias Bynens
Comment 3
2012-05-30 21:48:51 PDT
(In reply to
comment #2
)
> Could you please explain why this is wrong? I'm not disagreeing with you, it's just not obvious.
The DOCTYPE declaration is not acknowledged in the XPath/XSLT data model. “support for DTDs in the data model” is listed in Appendix G of the XSLT 1.0 Recommendation as a feature under consideration for future versions.
http://www.w3.org/TR/xslt#section-Features-under-Consideration-for-Future-Versions-of-XSLT
Alexey Proskuryakov
Comment 4
2012-05-30 23:09:42 PDT
The XSLT spec doesn't govern XPathEvaluator behavior. The best we have is <
http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html
>.
Mathias Bynens
Comment 5
2012-05-30 23:57:44 PDT
http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#Mapping
only lists these:
> 1.2.1 Element Nodes > 1.2.2 Attribute Nodes > 1.2.3 Namespace Nodes > 1.2.4 Text Nodes > 1.2.5 Entity Reference Nodes > 1.2.6 Comment Nodes > 1.2.7 Processing Instruction Nodes > 1.2.8 Document order
Document Type Nodes are not included.
Mathias Bynens
Comment 6
2012-05-31 06:50:02 PDT
This is probably a misinterpretation of
http://www.w3.org/TR/xpath/#NT-NodeType
, which says:
> A node test `node()` is true for any node of any type whatsoever.
This should have said:
> A node test `node()` is true for any node of any XPath-defined node type whatsoever.
This is clear when you look at the production below, which only mentions the specified node types:
> [7] NodeTest ::= NameTest > | NodeType '(' ')' > | 'processing-instruction' '(' Literal ')'
Where `NodeTest` is defined as:
> [38] NodeType ::= 'comment' > | 'text' > | 'processing-instruction' > | 'node'
Document type nodes are neither of those four options.
Lucas Forschler
Comment 7
2019-02-06 09:04:20 PST
Mass moving XML DOM bugs to the "DOM" Component.
Ahmad Saleem
Comment 8
2022-07-28 12:13:54 PDT
All browsers (Chrome Canary 106, Firefox Nightly 105 and Safari 15.6 on macOS 12.5) show "FAIL" in this test case, is it web-spec issue or all browsers haven't implemented something which is needed for this test?
Ryosuke Niwa
Comment 9
2022-07-28 13:21:13 PDT
All browsers agree -> Config Changed. Nothing to be done here.
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