Open rahimabdi opened 9 months ago
Competing text node definitions:
I think the spec should also define what the node's textual content is (found this issue by trying to answer the question about how whitespaces should be handled when computing the name).
I would propose using the DOM text interface definition: https://dom.spec.whatwg.org/#interface-text.
@OrKoN from my investigation, the "textual contents" of text nodes (Text interface) is its data
; text nodes implement the CharacterData interface which has a data
instance property:
Each node inheriting from the CharacterData interface has an associated mutable string called
data
.
In terms of DOM spec, for text nodes (and also comment nodes), they also inherit from the generic Node interface which has a nodeValue
property; it's my understanding that data
is the same thing as nodeValue
for text nodes.
Depending on the definition's granularity, the textual contents could be the data
of the text node although that is less readable than the node's "string value" or simply "text contents" IMO.
July 14 update: Specifically, it looks like the exclusive text node definition should be referenced from the Text interface. An "exclusive text node" is effectively the text contents that is referenced in accname per nodeType.
DOM spec states the definition of "exclusive text node" as:
An exclusive Text node is a Text node that is not a CDATASection node.
I think using text node data would not match the current behavior when dealing with whitespaces:
Source: data:text/html,<h2> foo</h2>
(nodeValue does appear to be the same in this accessible)
I think using text node data would not match the current behavior when dealing with whitespaces:
I believe trimming whitespace generally from accName/accDescription ((e.g., trailing/leading whitespace) is being tracked here: https://github.com/w3c/accname/issues/95.
In "4.3.2 Computation steps", Step 2G of the name computation algorithm states:
Although a "Node" definition is provided, it's not made explicit what a "text node" is. I would propose adding more documentation, e.g.,:
Other sections that would need updating with linked "node" references:
Further clarification from @cookiecrook and additional context for why this is being recommended in https://github.com/web-platform-tests/wpt/pull/42407#discussion_r1372401204: