Bug 22265
Summary: | Inconsistent handling of empty versus nil NSStrings for namespaceURI | ||
---|---|---|---|
Product: | WebKit | Reporter: | Kai BrĂ¼ning <kai> |
Component: | WebKit API | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED WONTFIX | ||
Severity: | Normal | CC: | ahmad.saleem792, ap, bfulgham, cdumez, illenberger, kai, mrowe, rniwa, sam |
Priority: | P2 | Keywords: | InRadar |
Version: | 528+ (Nightly build) | ||
Hardware: | Mac | ||
OS: | OS X 10.5 |
Kai BrĂ¼ning
-[DOMNode namespaceURI] returns an empty NSString (@"") for "no namespace".
But -[DOMNameNodeMap getNamedItemNS:localName:] does find an attribute without namespace only if nil is passed for the namespaceURI.
The DOM3-Core specification states: "In programming languages where empty strings can be differentiated from null, empty strings, when given as a namespace URI, are converted to null. This is true even though the DOM does no lexical checking of URIs." (1.3.3 XML Namespaces, page 27 in the pdf version).
Therefore it would probably be correct, if -[DOMNameNodeMap getNamedItemNS:localName:] converts an empty namespaceURI string to nil before performing the lookup.
Further, the same spec states about the namespaceURI property of interface Node: "The namespace URI [p.207] of this node, or null if it is unspecified (see XML Namespaces [p.26] ). " (page 61 of the pdf version).
Therefore -[DOMNode namespaceURI] should probably return nil instead of @"" for "no namespace".
Note: the C++ node actually has a NULL value for the namespaceURI string in this case. The conversion to @"" happens deep in the conversion code from WebCore string to NSString.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Mark Rowe (bdash)
<rdar://problem/6373807>
Ahmad Saleem
I think WPT has coverage for these cases:
https://wpt.fyi/results/dom/nodes/Node-lookupNamespaceURI.html?label=master&label=experimental&aligned&q=namespaceURI
and Safari 15.6 passes all test here. If I am understanding it wrong, please ignore my comment. Otherwise, if needed, please can this bug be marked as "RESOVLED WONTFIX" or "RESOLVED CONFIGURATION CHANGED". Thanks!
Alexey Proskuryakov
This bug is about Objective-C API, which WPT doesn't test.
At this point, this API is deprecated, and we don't intend to keep improving it. Please use the modern WebKit API.