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

Editorial rework of directionality #9452

Closed
wants to merge 4 commits into from
Closed
Changes from 2 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
160 changes: 94 additions & 66 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -13402,106 +13402,117 @@ Transport Protocol">HTTP&lt;/abbr> today.&lt;/p></code></pre> <!-- DO NOT REWRAP

<dl class="switch">


<dt>If the element's <code data-x="attr-dir">dir</code> attribute is in the <span
data-x="attr-dir-ltr-state">ltr</span> state</dt>

<dt>If the element is a <span>document element</span> and the <code data-x="attr-dir">dir</code>
attribute is not in a defined state (i.e. it is not present or has an invalid value)</dt>

<dt>If the element is an <code>input</code> element whose <code
data-x="attr-input-type">type</code> attribute is in the <span
data-x="attr-input-type-tel">Telephone</span> state, and the <code data-x="attr-dir">dir</code>
attribute is not in a defined state (i.e. it is not present or has an invalid value)</dt>

<dd><p><span>The directionality</span> of the element is '<span
data-x="concept-ltr">ltr</span>'.</p></dd>


<dt>If the element's <code data-x="attr-dir">dir</code> attribute is in the <span
data-x="attr-dir-rtl-state">rtl</span> state</dt>

<dd><p><span>The directionality</span> of the element is '<span
data-x="concept-rtl">rtl</span>'.</p></dd>

<dt>If the element is an <code>input</code> element whose <code
data-x="attr-input-type">type</code> attribute is in the <span
data-x="attr-input-type-text">Text</span>, <span data-x="attr-input-type-search">Search</span>,
<span data-x="attr-input-type-tel">Telephone</span>, <span
data-x="attr-input-type-url">URL</span>, or <span data-x="attr-input-type-email">Email</span>
state, and the <code data-x="attr-dir">dir</code> attribute is in the <span
<dt>If the element's <code data-x="attr-dir">dir</code> attribute is in the <span
data-x="attr-dir-auto-state">auto</span> state</dt>

<dt>If the element is a <code>textarea</code> element and the <code data-x="attr-dir">dir</code>
attribute is in the <span data-x="attr-dir-auto-state">auto</span> state</dt>
<dt>If the element is a <code>bdi</code> element and the <code data-x="attr-dir">dir</code>
attribute is not in a defined state (i.e. it is not present or has an invalid value)</dt>
bkardell marked this conversation as resolved.
Show resolved Hide resolved

<dd>
<p>If the element's <span data-x="concept-fe-value">value</span> contains a character of
bidirectional character type AL or R, and there is no character of bidirectional character type
L anywhere before it in the element's <span data-x="concept-fe-value">value</span>, then
<span>the directionality</span> of the element is '<span data-x="concept-rtl">rtl</span>'. <ref spec=BIDI></p>

<p>Otherwise, if the element's <span data-x="concept-fe-value">value</span> is not the empty
string, or if the element is a <span>document element</span>, <span>the directionality</span> of
the element is '<span data-x="concept-ltr">ltr</span>'.</p>
<p>The element's <span data-x="the directionality">directionality</span> is determined as
follows:</p>

bkardell marked this conversation as resolved.
Show resolved Hide resolved
<p>Otherwise, <span>the directionality</span> of the element is the same as the element's parent
element's <span data-x="the directionality">directionality</span>.</p>
</dd>
<dl class="switch">
<dt>If the element is an <code>input</code> element whose <code
data-x="attr-input-type">type</code> attribute is in the <span
data-x="attr-input-type-text">Text</span>, <span data-x="attr-input-type-search">Search</span>,
<span data-x="attr-input-type-tel">Telephone</span>, <span
data-x="attr-input-type-url">URL</span>, or <span
data-x="attr-input-type-email">Email</span> state</dt>
<dt>If the element is a <code>textarea</code> element</dt>
<dd>
bkardell marked this conversation as resolved.
Show resolved Hide resolved
<p>The element's <span data-x="the directionality">directionality</span> is determined
bkardell marked this conversation as resolved.
Show resolved Hide resolved
via the following steps:</p>
bkardell marked this conversation as resolved.
Show resolved Hide resolved
<dl class="switch">
<dt>If the element's <span data-x="concept-fe-value">value</span> contains a character of
bidirectional character type AL or R, and there is no character of bidirectional character
type L anywhere before it in the element's <span data-x="concept-fe-value">value</span></dt>
<dd><span>The directionality</span> of the element is '<span
data-x="concept-rtl">rtl</span>' <ref spec=BIDI>.

<dt>If the element's <span data-x="concept-fe-value">value</span> is the empty string, or if
the element has no parent element</dt>
<dd><span>The directionality</span> of the element is '<span
data-x="concept-ltr">ltr</span>'.</dd>

<dt>Otherwise</dt>
<dd><span>the directionality</span> of the element is the same as the element's parent
element's <span data-x="the directionality">directionality</span>.</dd>

<dt>If the element's <code data-x="attr-dir">dir</code> attribute is in the <span
data-x="attr-dir-auto-state">auto</span> state</dt>
</dl>
</dd>

<dt>If the element is a <code>bdi</code> element and the <code data-x="attr-dir">dir</code>
attribute is not in a defined state (i.e. it is not present or has an invalid value)</dt>
<dt>Otherwise</dt>
<dd>
<p><span>The directionality</span> is determined from the element's contents as follows:</p>
<ol>
<li><p>Let <var>b</var> be the first (in <span>tree order</span>)
<span>bidi-available</span> <span>strong character</span>
found among its <code>Text</code> nodes (including their descendants)</p>
</li>
<li>
<p>Determine <span>the directionality</span> from <var>b</var> as follows:</p>
<dl class="switch">

<dd>
<p>Find the first character in <span>tree order</span> that matches the following criteria:</p>
<dt>If <var>b</var> is a character is of bidirectional character type AL or R</dt>
<dd><span>The directionality</span> of the element is '<span
data-x="concept-rtl">rtl</span>'.</dd>

<ul>
<dt>If <var>b</var> is a character is of bidirectional character type L</dt>
<dd><span>The directionality</span> of the element is '<span
data-x="concept-ltr">ltr</span>'.</dd>

<li><p>The character is from a <code>Text</code> node that is a descendant of the element whose
<span data-x="the directionality">directionality</span> is being determined.</p></li>
<dt>If <var>b</var> is not found</dt>
<dd><span>The directionality</span> of the element is the same as if the element's <code
data-x="attr-dir">dir</code> attribute were not in a defined state (and the element
were not a <code>bdi</code> element).</dd>
</dl>
</li>
</ol>
</dd>
</dl>
</dd>

<li><p>The character is of bidirectional character type L, AL, or R. <ref spec=BIDI></li>
<dt>If the <code data-x="attr-dir">dir</code> attribute is not in a defined state (i.e. it is not
present or has an invalid value)</dt>

<li>
<p>The character is not in a <code>Text</code> node that has an ancestor element that is a
descendant of the element whose <span data-x="the directionality">directionality</span> is
being determined and that is either:</p>
<dd>
<p>The element's <span data-x="the directionality">directionality</span> is determined as
follows:</p>
<dl class="switch">
<dt>If the element is an <code>input</code> element whose
<code data-x="attr-input-type">type</code> attribute is in the
<span data-x="attr-input-type-tel">Telephone</span> state</dt>

<ul class="brief">
<li>A <code>bdi</code> element.
<li>A <code>script</code> element.
<li>A <code>style</code> element.
<li>A <code>textarea</code> element.
<li>An element with a <code data-x="attr-dir">dir</code> attribute in a defined state.
</ul>
</li>
<dd><p><span>The directionality</span> of the element is
'<span data-x="concept-ltr">ltr</span>'.</p></dd>

</ul>
<dt>If the element has a parent element</dt>

<p>If such a character is found and it is of bidirectional character type AL or R, <span>the
directionality</span> of the element is '<span data-x="concept-rtl">rtl</span>'.</p>
<dd><p><span>The directionality</span> of the element is the same as its
parent element's
<span data-x="the directionality">directionality</span>.</p></dd>

<p>If such a character is found and it is of bidirectional character type L, <span>the
directionality</span> of the element is '<span data-x="concept-ltr">ltr</span>'.</p>
<dt>Otherwise</dt>

<p>Otherwise, if the element is a <span>document element</span>, <span>the directionality</span>
of the element is '<span data-x="concept-ltr">ltr</span>'.</p>
<dd><p><span>The directionality</span> of the element is "<code
data-x="concept-ltr">ltr</code>".</p></dd>

<p>Otherwise, <span>the directionality</span> of the element is the same as the element's parent
element's <span data-x="the directionality">directionality</span>.</p>
</dl>
</dd>


<dt>If the element has a parent element and the <code data-x="attr-dir">dir</code> attribute is
not in a defined state (i.e. it is not present or has an invalid value)</dt>

<dd><p><span>The directionality</span> of the element is the same as the element's parent
element's <span data-x="the directionality">directionality</span>.</p></dd>
</dl>

<p class="note">Since the <code data-x="attr-dir">dir</code> attribute is only defined for
Expand All @@ -13515,6 +13526,23 @@ Transport Protocol">HTTP&lt;/abbr> today.&lt;/p></code></pre> <!-- DO NOT REWRAP
<p class="note">This attribute <a href="#bidireq">has rendering requirements involving the
bidirectional algorithm</a>.</p>

<p>A <span>strong character</span> is <dfn>bidi-available</dfn> to
bkardell marked this conversation as resolved.
Show resolved Hide resolved
an element <var>E</var> whose <span
data-x="the directionality">directionality</span> is
being determined only if it does <em>not</em> have an ancestor
element that is both a descendant of <var>E</var> and also a
<dfn>bidi-excluded element</dfn>:</p>
<ul class="brief">
<li>A <code>bdi</code> element.
bkardell marked this conversation as resolved.
Show resolved Hide resolved
<li>A <code>script</code> element.
<li>A <code>style</code> element.
<li>A <code>textarea</code> element.
<li>An element with a <code data-x="attr-dir">dir</code> attribute in a defined state.
</ul>

<p>A character is a <dfn>strong character</dfn> if the character is of bidirectional character
type L, AL, or R. <ref spec=BIDI></p>

</div>

<hr>
Expand Down