From 67ca225c73dd797d09eaef2a67d31f055eed234e Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Tue, 27 Feb 2024 11:33:23 -0800 Subject: [PATCH] Add steps for shadow roots and slots (#167) Co-authored-by: James Craig Co-authored-by: James Nurthen --- index.html | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 9e76621..0247a85 100644 --- a/index.html +++ b/index.html @@ -334,6 +334,8 @@

Terminology

The DOM [=nodes|node=] or [=element=] for which the text alternative is sought.
Current node
The DOM [=nodes|node=] currently traversed to compute the root node's text equivalent. Initially, the current node is the root node, but at later stages is either some descendant of the root node, or another referenced node.
+
Rendered child nodes
+
The [=nodes=] that are rendered as child nodes of a given node when taking [=shadow root|shadow roots=] and [=slot|slots=] into consideration.
Flat string
A string of characters where all carriage returns, newlines, tabs, and form-feeds are replaced with a single space, and multiple spaces are reduced to a single space. The string contains only character data; it does not contain any markup.
Total accumulated text
@@ -496,9 +498,17 @@

Computation steps

  • For ::after pseudo elements, User agents MUST append CSS textual content, without a space, to the textual content of the current node.
  • -
  • Name From Each Child: For each child node of the current node: + +
  • Determine Child Nodes: Determine the rendered child nodes of the current node:
      -
    1. Set the current node to the child node.
    2. +
    3. If the current node has an attached [=shadow root=], set the rendered child nodes to be the child nodes of the [=shadow root=].
    4. +
    5. Otherwise, if the current node is a [=slot=] with [=slot/assigned nodes=], set the rendered child nodes to be the [=slot/assigned nodes=] of the current node.
    6. +
    7. Otherwise, set the rendered child nodes to be the child nodes of the current node.
    8. +
    +
  • +
  • Name From Each Child: For each rendered child node of the current node: +
      +
    1. Set the current node to the rendered child node.
    2. Compute the text alternative of the current node beginning with the overall Computation step. Set the result to that text alternative.
    3. Append the result to the accumulated text.