@@ -13283,7 +13283,8 @@ Transport Protocol">HTTP</abbr> today.</p></code></pre> <!-- DO NOT REWRAP
1328313283 <ref>XML</ref></p>
1328413284
1328513285 <p>If these attributes are omitted from an element, then the language of this element is the same
13286- as the language of its parent element, if any.</p>
13286+ as the language of its parent element, if any (except for <code>slot</code> elements in a
13287+ <span>shadow tree</span>).</p>
1328713288
1328813289 <p>The <code data-x="attr-lang">lang</code> attribute in no namespace may be used on any <span
1328913290 data-x="HTML elements">HTML element</span>.</p>
@@ -13314,28 +13315,36 @@ Transport Protocol">HTTP</abbr> today.</p></code></pre> <!-- DO NOT REWRAP
1331413315
1331513316 <hr>
1331613317
13317- <p>To determine the <dfn export for="Node">language</dfn> of a node, user agents must look at the
13318- nearest ancestor element (including the element itself if the node is an element) that has a <span
13319- data-x="attr-xml-lang"><code data-x="">lang</code> attribute in the <span>XML
13320- namespace</span></span> set or is an <span data-x="HTML elements">HTML element</span> and has a
13321- <code data-x="attr-lang">lang</code> in no namespace attribute set. That attribute specifies the
13322- language of the node (regardless of its value).</p>
13323-
13324- <p>If both the <code data-x="attr-lang">lang</code> attribute in no namespace and the <span
13325- data-x="attr-xml-lang"><code data-x="">lang</code> attribute in the <span>XML
13326- namespace</span></span> are set on an element, user agents must use the <span
13327- data-x="attr-xml-lang"><code data-x="">lang</code> attribute in the <span>XML
13328- namespace</span></span>, and the <code data-x="attr-lang">lang</code> attribute in no namespace
13329- must be <span data-x="ignore">ignored</span> for the purposes of determining the element's
13330- language.</p>
13318+ <p>To determine the <dfn export for="Node">language</dfn> of a node, user agents must use the
13319+ first appropriate step in the following list:</p>
13320+
13321+ <dl class="switch">
13322+ <dt>If the node is an element that has a <span data-x="attr-xml-lang"><code data-x="">lang</code>
13323+ attribute in the <span>XML namespace</span></span> set</dt>
13324+ <dd><p>Use the value of that attribute.</p></dd>
13325+
13326+ <dt>If the node is an <span data-x="HTML elements">HTML element</span> and has a <code
13327+ data-x="attr-lang">lang</code> in no namespace attribute set.</dt>
13328+ <dd><p>Use the value of that attribute.</p></dd>
1333113329
13332- <p>If node's <span data-x="inclusive ancestor">inclusive ancestors</span> do not have either
13333- attribute set, but there is a <span>pragma-set default language</span> set, then that is the
13334- language of the node. If there is no <span>pragma-set default language</span> set, then language
13335- information from a higher-level protocol (such as HTTP), if any, must be used as the final
13336- fallback language instead. In the absence of any such language information, and in cases where the
13337- higher-level protocol reports multiple languages, the language of the node is unknown, and the
13338- corresponding language tag is the empty string.</p>
13330+ <dt>If the node's parent is a <span>shadow root</span></dt>
13331+ <dt>If the node is a <code>slot</code> element whose <span>root</span> is a <span>shadow
13332+ root</span></dt>
13333+ <dd><p>Use the <span>language</span> of that <span>shadow root</span>'s <span
13334+ data-x="concept-DocumentFragment-host">host</span>.</p></dd>
13335+
13336+ <!-- this assumes that if there's an ancestor element, the parent must be an element -->
13337+ <dt>If the node's <span>parent element</span> is not null</dt>
13338+ <dd><p>Use the <span>language</span> of that <span>parent element</span>.</p></dd>
13339+
13340+ <dt>Otherwise</dt>
13341+ <dd><p>If there is a <span>pragma-set default language</span> set, then that is the language of
13342+ the node. If there is no <span>pragma-set default language</span> set, then language information
13343+ from a higher-level protocol (such as HTTP), if any, must be used as the final fallback language
13344+ instead. In the absence of any such language information, and in cases where the higher-level
13345+ protocol reports multiple languages, the language of the node is unknown, and the corresponding
13346+ language tag is the empty string.</p></dd>
13347+ </dl>
1333913348
1334013349 <p>If the resulting value is not a recognized language tag, then it must be treated as an unknown
1334113350 language having the given language tag, distinct from all other languages. For the purposes of
@@ -13551,7 +13560,17 @@ Transport Protocol">HTTP</abbr> today.</p></code></pre> <!-- DO NOT REWRAP
1355113560 <dd><p>Return '<span data-x="concept-rtl">rtl</span>'.</p></dd>
1355213561
1355313562 <dt><span data-x="attr-dir-auto-state">auto</span></dt>
13554- <dd><p>Return the <span>auto directionality</span> of <var>element</var>.</p></dd>
13563+ <dd>
13564+ <ol>
13565+ <li><p>Let <var>result</var> be the <span>auto directionality</span> of
13566+ <var>element</var>.</p></li>
13567+
13568+ <li><p>If <var>result</var> is null, then return the <span>parent directionality</span> of
13569+ <var>element</var>.</p></li>
13570+
13571+ <li><p>Return <var>result</var>.</p></li>
13572+ </ol>
13573+ </dd>
1355513574
1355613575 <dt><span data-x="attr-dir-undefined-state">undefined</span></dt>
1355713576 <dd>
@@ -13594,47 +13613,106 @@ Transport Protocol">HTTP</abbr> today.</p></code></pre> <!-- DO NOT REWRAP
1359413613 <li><p>If <var>element</var>'s <span data-x="concept-fe-value">value</span> is not the empty
1359513614 string, then return '<span data-x="concept-ltr">ltr</span>'.</p></li>
1359613615
13597- <li><p>Return the <span>parent directionality</span> of <var>element</var> .</p></li>
13616+ <li><p>Return null .</p></li>
1359813617 </ol>
1359913618 </li>
1360013619
13601- <li><p>Let <var>codePoint</var> be null.</p></li>
13620+ <li>
13621+ <p>If <var>element</var> is a <code>slot</code> element whose <span>root</span> is a
13622+ <span>shadow root</span> and <var>element</var>'s <span>assigned nodes</span> are not empty:</p>
13623+
13624+ <ol>
13625+ <li>
13626+ <p><span data-x="list iterate">For each</span> node <var>child</var> of <var>element</var>'s
13627+ <span>assigned nodes</span>:</p>
13628+
13629+ <ol>
13630+ <li><p>Let <var>childDirection</var> be null.</p></li>
13631+
13632+ <li><p>If <var>child</var> is a <code>Text</code> node, then set <var>childDirection</var> to
13633+ the <span>text node directionality</span> of <var>child</var>.</p></li>
13634+
13635+ <li>
13636+ <p>Otherwise:</p>
13637+
13638+ <ol>
13639+ <li><p><span>Assert</span>: <var>child</var> is an <code>Element</code> node.</p></li>
13640+
13641+ <li><p>Set <var>childDirection</var> to the <span>auto directionality</span> of
13642+ <var>child</var>.</p></li>
13643+ </ol>
13644+ </li>
13645+
13646+ <li><p>If <var>childDirection</var> is not null, then return
13647+ <var>childDirection</var>.</p></li>
13648+ </ol>
13649+ </li>
13650+
13651+ <li><p>Return null.</p></li>
13652+ </ol>
13653+ </li>
1360213654
1360313655 <li>
13604- <p>For each <code>Text</code> node <var>text</var> that is a descendant of <var>element</var>,
13605- in <span>tree order</span>:</p>
13656+ <p><span data-x="list iterate">For each</span> node <var>descendant</var> of
13657+ <var>element</var>'s <span data-x="descendant">descendants</span>, in <span>tree
13658+ order</span>:</p>
1360613659
1360713660 <ol>
1360813661 <li>
13609- <p>If <var>text </var> has an ancestor element that is a descendant of <var>element</var> and
13610- is also one of</p>
13662+ <p>If <var>descendant </var> has an ancestor element that is a descendant of <var>element</var>
13663+ and is also one of</p>
1361113664
1361213665 <ul class="brief">
1361313666 <li>a <code>bdi</code> element</li>
1361413667 <li>a <code>script</code> element</li>
1361513668 <li>a <code>style</code> element</li>
1361613669 <li>a <code>textarea</code> element</li>
13670+ <li>a <code>slot</code> element whose <span>root</span> is a <span>shadow
13671+ root</span></li>
1361713672 <li>an element whose <code data-x="attr-dir">dir</code> attribute is not in the <span
1361813673 data-x="attr-dir-undefined-state">undefined</span> state</li>
1361913674 </ul>
1362013675
1362113676 <p>then <span>continue</span>.</p>
1362213677 </li>
1362313678
13624- <li><p>If <var>text</var>'s <span data-x="concept-cd-data">data</span> does not contain a code
13625- point whose bidirectional character type is L, AL, or R, then <span>continue </span>.
13626- <ref>BIDI</ref> </p></li >
13679+ <li>
13680+ <p>If <var>descendant</var> is a <code>slot</code> element whose <span>root </span> is a
13681+ <span>shadow root</span>, then: </p>
1362713682
13628- <li><p>Set <var>codePoint</var> to the first code point in <var>text</var>'s <span
13629- data-x="concept-cd-data">data</span> whose bidirectional character type is L, AL, or
13630- R.</p></li>
13683+ <ol>
13684+ <li><p>Let <var>result</var> be the <span>auto directionality</span> of
13685+ <var>descendant</var>.</p></li>.
13686+
13687+ <li><p>If <var>result</var> is not null, then return <var>result</var>.</p></li>
1363113688
13632- <li><p><span>Break</span>.</p></li>
13689+ <li><p>Return '<span data-x="concept-ltr">ltr</span>'.</p></li>
13690+ </ol>
13691+ </li>
13692+
13693+ <li><p>If <var>descendant</var> is not a <code>Text</code> node, then
13694+ <span>continue</span>.</p></li>
13695+
13696+ <li><p>Let <var>result</var> be the <span>text node directionality</span> of
13697+ <var>descendant</var>.</li>
13698+
13699+ <li><p>If <var>result</var> is not null, then return <var>result</var>.</p></li>
1363313700 </ol>
1363413701 </li>
1363513702
13636- <li><p>If <var>codePoint</var> is null, then return the <span>parent directionality</span> of
13637- <var>element</var>.</p></li>
13703+ <li><p>Return null.</p></li>
13704+ </ol>
13705+
13706+ <p>To compute the <dfn>text node directionality</dfn> given a <code>Text</code> node
13707+ <var>text</var>:</p>
13708+
13709+ <ol>
13710+ <li><p>If <var>text</var>'s <span data-x="concept-cd-data">data</span> does not contain a code
13711+ point whose bidirectional character type is L, AL, or R, then return null.
13712+ <ref>BIDI</ref></p></li>
13713+
13714+ <li><p>Let <var>codePoint</var> be the first code point in <var>text</var>'s <span
13715+ data-x="concept-cd-data">data</span> whose bidirectional character type is L, AL, or R.</p></li>
1363813716
1363913717 <li><p>If <var>codePoint</var> is of bidirectional character type AL or R, then return '<span
1364013718 data-x="concept-rtl">rtl</span>'.</p></li>
@@ -13646,11 +13724,21 @@ Transport Protocol">HTTP</abbr> today.</p></code></pre> <!-- DO NOT REWRAP
1364613724 <p>To compute the <dfn>parent directionality</dfn> given an element <var>element</var>:</p>
1364713725
1364813726 <ol>
13649- <li><p>If <var>element</var> has no <span>parent element</span>, then return '<span
13650- data-x="concept-ltr">ltr</span>'.</p></li>
13727+ <li><p>If <var>element</var> is a <code>slot</code> element whose <span>root</span> is a
13728+ <span>shadow root</span>, then return the <span data-x="the directionality">directionality</span>
13729+ of <var>element</var>'s <span>root</span>'s <span
13730+ data-x="concept-DocumentFragment-host">host</span>.</p></li>
13731+
13732+ <li><p>Let <var>parentNode</var> be <var>element</var>'s parent node.</p></li>
13733+
13734+ <li><p>If <var>parentNode</var> is a <span>shadow root</span>, then return the <span data-x="the
13735+ directionality">directionality</span> of <var>parentNode</var>'s <span
13736+ data-x="concept-DocumentFragment-host">host</span>.</p></li>
13737+
13738+ <li><p>If <var>parentNode</var> is an element, then return the <span data-x="the
13739+ directionality">directionality</span> of <var>parentNode</var>.</p></li>
1365113740
13652- <li><p>Return <span data-x="the directionality">directionality</span> of <var>element</var>'s
13653- <span data-x="parent element">parent</span>.</p></li>
13741+ <li><p>Return '<span data-x="concept-ltr">ltr</span>'.</p></li>
1365413742 </ol>
1365513743
1365613744 <div w-nodev>
@@ -129391,15 +129479,16 @@ br[clear=all i], br[clear=both i] { clear: both; }</code></pre>
129391129479
129392129480 <pre><code class="css">@namespace "http://www.w3.org/1999/xhtml";
129393129481
129394- [dir]:dir(ltr), bdi:dir(ltr), input[type=tel i]:dir(ltr) { direction: ltr; }
129395- [dir]:dir(rtl), bdi:dir(rtl) { direction: rtl; }
129482+ [dir]:dir(ltr), slot:dir(ltr), bdi:dir(ltr), input[type=tel i]:dir(ltr) { direction: ltr; }
129483+ [dir]:dir(rtl), slot:dir(rtl), bdi:dir(rtl) { direction: rtl; }
129396129484
129397129485address, blockquote, center, div, figure, figcaption, footer, form, header, hr,
129398129486legend, listing, main, p, plaintext, pre, summary, xmp, article, aside, h1, h2,
129399129487h3, h4, h5, h6, hgroup, nav, section, search, table, caption, colgroup, col,
129400129488thead, tbody, tfoot, tr, td, th, dir, dd, dl, dt, menu, ol, ul, li, bdi, output,
129401- [dir=ltr i], [dir=rtl i], [dir=auto i] {
129402- unicode-bidi: isolate; <!-- anything that's similar to display:block, plus <bdi>, <output>, and dir="" -->
129489+ slot, [dir=ltr i], [dir=rtl i], [dir=auto i] {
129490+ unicode-bidi: isolate; <!-- anything that's similar to display:block, plus
129491+ <bdi>, <output>, <slot>, and dir="" -->
129403129492}
129404129493
129405129494bdo, bdo[dir] { unicode-bidi: isolate-override; } <!-- bdo[dir] rule is to override the otherwise higher-specificity attribute selectors in the previous rule -->
0 commit comments