Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect recursion for dir=auto special cases. #10561

Merged
merged 4 commits into from
Aug 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -13775,8 +13775,10 @@ Transport Protocol">HTTP&lt;/abbr> today.&lt;/p></code></pre> <!-- DO NOT REWRAP
<ol>
<li><p><span>Assert</span>: <var>child</var> is an <code>Element</code> node.</p></li>

<li><p>Set <var>childDirection</var> to the <span>auto directionality</span> of
<var>child</var>.</p></li>
<li><p>Set <var>childDirection</var> to the <span>contained text auto directionality</span>
of <var>child</var> with <i><span
annevk marked this conversation as resolved.
Show resolved Hide resolved
data-x="auto-directionality-can-exclude-root">canExcludeRoot</span></i> set to
true.</p></li>
</ol>
</li>

Expand All @@ -13789,15 +13791,32 @@ Transport Protocol">HTTP&lt;/abbr> today.&lt;/p></code></pre> <!-- DO NOT REWRAP
</ol>
</li>
dbaron marked this conversation as resolved.
Show resolved Hide resolved

<li><p>Return the <span>contained text auto directionality</span> of <var>element</var> with
<i><span data-x="auto-directionality-can-exclude-root">canExcludeRoot</span></i> set to
false.</p></li>
</ol>

<p>To compute the <dfn>contained text auto directionality</dfn> of an element
<var>element</var> with a boolean <dfn
data-x="auto-directionality-can-exclude-root"><var>canExcludeRoot</var></dfn>:</p>

<ol>
<li>
<p><span data-x="list iterate">For each</span> node <var>descendant</var> of
<var>element</var>'s <span data-x="descendant">descendants</span>, in <span>tree
order</span>:</p>

annevk marked this conversation as resolved.
Show resolved Hide resolved
<ol>
<li>
<p>If <var>descendant</var>, or any of its ancestor elements that are descendants of
<var>element</var>, is one of</p>
<p>If any of</p>

<ul class="brief">
<li><var>descendant</var></li>
<li>any ancestor element of <var>descendant</var> that is a descendant of <var>element</var></li>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still very much a mouthful :) But I don't have good ideas how to make this easier to read.

<li>if <var>canExcludeRoot</var> is true, <var>element</var></li>
Copy link

@smaug---- smaug---- Sep 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just realized, this is a really odd algorithm. One goes through all the descendants, but if element is one of the things below, continue. The behavior is ok, but this is quite hard to read. I can blame myself for not thinking this more while reviewing :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's really intended to represent a tree traversal that excludes certain subtrees. However, we don't have good spec language for that. (Maybe we should write some!)

</ul>

<p>is one of</p>

<ul class="brief">
<li>a <code>bdi</code> element</li>
Expand Down