Skip to content

Commit

Permalink
[giow] (1) Let human-readable attributes honour dir=auto separately f…
Browse files Browse the repository at this point in the history
…rom the element's contents.

Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=17829
Affected topics: HTML, Rendering

git-svn-id: http://svn.whatwg.org/webapps@7799 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Apr 10, 2013
1 parent 8929547 commit 7711002
Show file tree
Hide file tree
Showing 3 changed files with 262 additions and 21 deletions.
91 changes: 83 additions & 8 deletions complete.html
Expand Up @@ -248,7 +248,7 @@

<header class=head id=head><p><a class=logo href=http://www.whatwg.org/><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
<hgroup><h1 class=allcaps>HTML</h1>
<h2 class="no-num no-toc">Living Standard &mdash; Last Updated 9 April 2013</h2>
<h2 class="no-num no-toc">Living Standard &mdash; Last Updated 10 April 2013</h2>
</hgroup><dl><dt><strong>Web developer edition:</strong></dt>
<dd><strong><a href=http://developers.whatwg.org/>http://developers.whatwg.org/</a></strong></dd>
<dt>Multiple-page version:</dt>
Expand Down Expand Up @@ -9678,7 +9678,7 @@ <h5 id=the-translate-attribute><span class=secno>3.2.3.4 </span>The <code title=
<code title=attr-menu-label><a href=#attr-menu-label>menu</a></code>,
<code title=attr-optgroup-label><a href=#attr-optgroup-label>optgroup</a></code>,
<code title=attr-option-label><a href=#attr-option-label>option</a></code>, and
<code title=attr-track-label><a href=#attr-track-label>label</a></code> elements</li>
<code title=attr-track-label><a href=#attr-track-label>track</a></code> elements</li>
<li><code title=attr-lang><a href=#attr-lang>lang</a></code> on <a href=#html-elements>HTML elements</a>; must be "translated" to match the language used in the translation</li>
<li><code title="">placeholder</code> on <code title=attr-input-placeholder><a href=#attr-input-placeholder>input</a></code> and
<code title=attr-textarea-placeholder><a href=#attr-textarea-placeholder>textarea</a></code> elements</li>
Expand Down Expand Up @@ -9769,7 +9769,7 @@ <h5 id=the-dir-attribute><span class=secno>3.2.3.6 </span>The <dfn title=attr-di

</dl><p>The attribute has no <i>invalid value default</i> and no <i>missing value default</i>.</p>

<p><dfn id=the-directionality>The directionality</dfn> of an element (any element, not just an <a href=#html-elements title="HTML
<hr><p><dfn id=the-directionality>The directionality</dfn> of an element (any element, not just an <a href=#html-elements title="HTML
elements">HTML element</a>) is either '<dfn id=concept-ltr title=concept-ltr>ltr</dfn>' or '<dfn id=concept-rtl title=concept-rtl>rtl</dfn>', and is determined as per the first appropriate set of steps from
the following list:</p>

Expand Down Expand Up @@ -9854,7 +9854,47 @@ <h5 id=the-dir-attribute><span class=secno>3.2.3.6 </span>The <dfn title=attr-di
directionality">directionality</a> from their parent element, or, if they don't have one,
default to '<a href=#concept-ltr title=concept-ltr>ltr</a>'.</p>

<p>The effect of this attribute is primarily on the presentation layer. For example, the rendering
<hr><p>The <dfn id=directionality-of-the-attribute title="directionality of the attribute">directionality of an attribute</dfn> of an
<a href=#html-elements title="HTML elements">HTML element</a>, which is used when the text of that attribute is
to be included in the rendering in some manner, is determined as per the first appropriate set of
steps from the following list:</p>

<dl class=switch><dt>If the attribute is a <a href=#directionality-capable-attribute>directionality-capable attribute</a> and the element's <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute is in the <a href=#attr-dir-auto-state title=attr-dir-auto-state>auto</a>
state</dt>

<dd>

<p>Find the first character (in logical order) of the attribute's value that is of bidirectional
character type L, AL, or R. <a href=#refsBIDI>[BIDI]</a></p>

<p>If such a character is found and it is of bidirectional character type AL or R,
<a href=#directionality-of-the-attribute>directionality of the attribute</a> is '<a href=#concept-rtl title=concept-rtl>rtl</a>'.</p>

<p>Otherwise, the <a href=#directionality-of-the-attribute>directionality of the attribute</a> is '<a href=#concept-ltr title=concept-ltr>ltr</a>'.</p>

</dd>

<dt>Otherwise</dt>

<dd>The <a href=#directionality-of-the-attribute>directionality of the attribute</a> is the same as <a href=#the-directionality title="the
directionality">the element's directionality</a>.</dd>

</dl><p>The following attributes are <dfn id=directionality-capable-attribute title="directionality-capable attribute">directionality-capable attributes</dfn>:</p>

<ul class=brief><li><code title=attr-th-abbr><a href=#attr-th-abbr>abbr</a></code> on <code><a href=#the-th-element>th</a></code> elements</li>
<li><code title="">alt</code> on <code title=attr-area-alt><a href=#attr-area-alt>area</a></code>,
<code title=attr-img-alt><a href=#attr-img-alt>img</a></code>, and
<code title=attr-input-alt><a href=#attr-input-alt>input</a></code> elements</li>
<li><code title=attr-meta-content><a href=#attr-meta-content>content</a></code> on <code><a href=#the-meta-element>meta</a></code> elements, if the <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute specifies a metadata name whose value is primarily intended to be human-readable rather than machine-readable</li>
<li><code title="">label</code> on <code title=attr-menuitem-label><a href=#attr-menuitem-label>menuitem</a></code>,
<code title=attr-menu-label><a href=#attr-menu-label>menu</a></code>,
<code title=attr-optgroup-label><a href=#attr-optgroup-label>optgroup</a></code>,
<code title=attr-option-label><a href=#attr-option-label>option</a></code>, and
<code title=attr-track-label><a href=#attr-track-label>track</a></code> elements</li>
<li><code title="">placeholder</code> on <code title=attr-input-placeholder><a href=#attr-input-placeholder>input</a></code> and
<code title=attr-textarea-placeholder><a href=#attr-textarea-placeholder>textarea</a></code> elements</li>
<li><code title=attr-title><a href=#attr-title>title</a></code> on all <a href=#html-elements>HTML elements</a> elements</li>
</ul><hr><p>The effect of this attribute is primarily on the presentation layer. For example, the rendering
section in this specification defines a mapping from this attribute to the CSS 'direction' and
'unicode-bidi' properties, and CSS defines rendering in terms of those properties.</p>

Expand Down Expand Up @@ -24539,7 +24579,7 @@ <h4 id=the-iframe-element><span class=secno>4.8.2 </span>The <dfn><code>iframe</
<li><p>Unset <var title="">child document</var>'s <a href=#iframe-load-in-progress>iframe load in progress</a>
flag.</li>

</ol><p class=warning>This, in conjunction with scriptingy, can be used to probe the URL space of the
</ol><p class=warning>This, in conjunction with scripting, can be used to probe the URL space of the
local network's HTTP servers. User agents may implement <a href=#origin title=origin>cross-origin</a>
access control policies that are stricter than those described above to mitigate this attack, but
unfortunately such policies are typically not compatible with existing Web content.</p>
Expand Down Expand Up @@ -95415,10 +95455,10 @@ <h4 id=text-rendered-in-native-user-interfaces><span class=secno>14.7.4 </span>T
<p>User agents are expected to honor the Unicode semantics of text
that is exposed in user interfaces, for example supporting the
bidirectional algorithm in text shown in dialogs, title bars, pop-up
menus, and tooltips. Text from elements (either attribute values or
the contents of elements) is expected to be rendered in a manner
menus, and tooltips. Text from the contents of elements is expected to be rendered in a manner
that honors <a href=#the-directionality>the directionality</a> of the element from
which the text was obtained.</p>
which the text was obtained. Text from attributes is expected to
be rendered in a manner that honours the <a href=#directionality-of-the-attribute>directionality of the attribute</a>.</p>

<div class=example>

Expand Down Expand Up @@ -95449,6 +95489,41 @@ <h4 id=text-rendered-in-native-user-interfaces><span class=secno>14.7.4 </span>T

</div>

<div class=example>

<p>The directionality of attributes depends on the attribute and on the element's <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute, as the following example demonstrates. Consider this
markup:</p>

<pre><bdo dir=ltr>&lt;table&gt;
&lt;tr&gt;
&lt;th abbr="(&#1488;" dir=ltr&gt;A
&lt;th abbr="(&#1488;" dir=rtl&gt;A
&lt;th abbr="(&#1488;" dir=auto&gt;A
&lt;/table&gt;</bdo></pre>

<p>If the <code title=attr-th-abbr><a href=#attr-th-abbr>abbr</a></code> attributes are rendered, e.g. in a tooltip or
other user interface, the first will have a left parenthesis (because the direction is 'ltr'),
the second will have a right parenthesis (because the direction is 'rtl'), and the third will
have a right parenthesis (because the direction is determined <em>from the attribute value</em>
to be 'rtl').</p>

<p>However, if instead the attribute was not a <a href=#directionality-capable-attribute>directionality-capable attribute</a>, the
results would be different:</p>

<pre><bdo dir=ltr>&lt;table&gt;
&lt;tr&gt;
&lt;th data-abbr="(&#1488;" dir=ltr&gt;A
&lt;th data-abbr="(&#1488;" dir=rtl&gt;A
&lt;th data-abbr="(&#1488;" dir=auto&gt;A
&lt;/table&gt;</bdo></pre>

<p>In this case, if the user agent were to expose the <code title="">data-abbr</code> attribute
in the user interface (e.g. in a debugging environment), the last case would be rendered with a
<em>left</em> parenthesis, because the direction would be determined from the element's
contents.</p>

</div>

<p>A string provided by a script (e.g. the argument to <code title=dom-alert><a href=#dom-alert>window.alert()</a></code>) is expected to be treated
as an independent set of one or more bidirectional algorithm
paragraphs when displayed, as defined by the bidirectional
Expand Down

0 comments on commit 7711002

Please sign in to comment.