[html5] r5672 - [giow] (0) Revamp how dir='' is implemented; add dir=auto; update to recent CSS [...]

whatwg at whatwg.org whatwg at whatwg.org
Mon Nov 8 16:58:00 PST 2010


Author: ianh
Date: 2010-11-08 16:57:59 -0800 (Mon, 08 Nov 2010)
New Revision: 5672

Modified:
   complete.html
   index
   source
Log:
[giow] (0) Revamp how dir='' is implemented; add dir=auto; update to recent CSS developments.
Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=10808

Modified: complete.html
===================================================================
--- complete.html	2010-11-05 20:10:49 UTC (rev 5671)
+++ complete.html	2010-11-09 00:57:59 UTC (rev 5672)
@@ -214,7 +214,7 @@
 
   <header class=head id=head><p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
    <hgroup><h1>Web Applications 1.0</h1>
-    <h2 class="no-num no-toc">Draft Standard — 5 November 2010</h2>
+    <h2 class="no-num no-toc">Draft Standard — 9 November 2010</h2>
    </hgroup><p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
    <p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
    <!--<p class="impl"><strong>Implementors!</strong> We have a <a href="http://www.whatwg.org/mailing-list#implementors">mailing list</a> for you too!</p>-->
@@ -9630,41 +9630,127 @@
 
   <p>The <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute specifies the
   element's text directionality. The attribute is an <a href=#enumerated-attribute>enumerated
-  attribute</a> with the keyword <code title="">ltr</code> mapping
-  to the state <i>ltr</i>, and the keyword <code title="">rtl</code>
-  mapping to the state <i>rtl</i>. The attribute has no <i>invalid
-  value default</i> and no <i>missing value default</i>.</p>
+  attribute</a> with the following keywords and states:</p>
 
-  <div class=impl>
+  <dl><dt>The <dfn id=attr-dir-ltr title=attr-dir-ltr><code>ltr</code></dfn> keyword, which maps to the <dfn id=attr-dir-ltr-state title=attr-dir-ltr-state>ltr</dfn> state</dt>
 
-  <p>The processing of this attribute is primarily performed by 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>
+   <dd>
 
-  </div>
+    <p>Indicates that the contents of the element are explicitly
+    directionally embedded left-to-right text.</p>
 
-  <p><dfn id=the-directionality>The directionality</dfn> of an element, which is used in
-  particular by the <code><a href=#the-canvas-element>canvas</a></code> element's text rendering API,
-  is either 'ltr' or 'rtl'. If the user agent supports CSS and the
-  'direction' property on this element has a computed value of either
-  'ltr' or 'rtl', then that is <a href=#the-directionality>the directionality</a> of the
-  element. Otherwise, if the element is <a href=#being-rendered>being rendered</a>,
-  then <a href=#the-directionality>the directionality</a> of the element is the
-  directionality used by the presentation layer, potentially
-  determined from the value of the <code title=attr-dir><a href=#the-dir-attribute>dir</a></code>
-  attribute on the element. Otherwise, if the element's <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute has the state <i>ltr</i>, the
-  element's directionality is 'ltr' (left-to-right); if the attribute
-  has the state <i>rtl</i>, the element's directionality is 'rtl'
-  (right-to-left); and otherwise, the element's directionality is the
-  same as its parent element, or 'ltr' if there is no parent
-  element.</p>
+   </dd>
 
+   <dt>The <dfn id=attr-dir-rtl title=attr-dir-rtl><code>rtl</code></dfn> keyword, which maps to the <dfn id=attr-dir-rtl-state title=attr-dir-rtl-state>rtl</dfn> state</dt>
+
+   <dd>
+
+    <p>Indicates that the contents of the element are explicitly
+    directionally embedded right-to-left text.</p>
+
+   </dd>
+
+   <dt>The <dfn id=attr-dir-auto title=attr-dir-auto><code>auto</code></dfn> keyword, which maps to the <dfn id=attr-dir-auto-state title=attr-dir-auto-state>auto</dfn> state</dt>
+
+   <dd>
+
+    <p>Indicates that the contents of the element are explicitly
+    embedded text, but that the direction is to be determined
+    programmatically using the contents of the element (as described
+    below).</p>
+
+    <p class=note>The heuristic used by this state is very crude (it
+    just looks at the first character with a strong directionality, in
+    a manner analogous to the Paragraph Level determination in the
+    bidirectional algorithm). Authors are urged to only use this value
+    as a last resort when the direction of the text is truly unknown
+    and no better server-side heuristic can be applied.</p>
+
+   </dd>
+
+  </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 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>
+
+  <dl class=switch><dt>If the element's <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute is
+   in the <a href=#attr-dir-ltr-state title=attr-dir-ltr-state>ltr</a> state</dt>
+
+   <dd><p><a href=#the-directionality>The directionality</a> of the element is '<a href=#concept-ltr title=concept-ltr>ltr</a>'.</dd>
+
+
+   <dt>If the element's <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute is
+   in the <a href=#attr-dir-rtl-state title=attr-dir-rtl-state>rtl</a> state</dt>
+
+   <dd><p><a href=#the-directionality>The directionality</a> of the element is '<a href=#concept-rtl title=concept-rtl>rtl</a>'.</dd>
+
+
+   <dt>If 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>
+
+   <dt>If the element is a <code><a href=#the-bdi-element>bdi</a></code> element and the <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute is not in a defined state
+   (i.e. it is not present or has an invalid value)</dt>
+
+   <dd>
+
+    <p>Find the first character in <a href=#tree-order>tree order</a> that
+    matches the following criteria:</p>
+
+    <ul><li><p>The character is from a <a href=#text-node>text node</a> that is a
+     descendant of the element whose <a href=#the-directionality title="the
+     directionality">directionality</a> is being
+     determined.</li>
+
+     <li><p>The character is of bidirectional character type L, AL,
+     or R. <a href=#refsBIDI>[BIDI]</a></li>
+
+     <li>
+
+      <p>The character is not in a text node that has an ancestor
+      element that is a descendant of the element whose <a href=#the-directionality title="the directionality">directionality</a> is being
+      determined and that is either:</p>
+
+      <ul class=brief><li>A <code><a href=#script>script</a></code> element.
+       <li>A <code><a href=#the-style-element>style</a></code> element.
+       <li>An element with a <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute in a defined state.
+      </ul></li>
+
+    </ul><p>If such a character is found and it is of bidirectional
+    character type AL or R, <a href=#the-directionality>the directionality</a> of the
+    element is '<a href=#concept-rtl title=concept-rtl>rtl</a>'.</p>
+
+    <p>Otherwise, <a href=#the-directionality>the directionality</a> of the element is
+    '<a href=#concept-ltr title=concept-ltr>ltr</a>'.</p>
+
+   </dd>
+
+
+
+   <dt>If the element is a <a href=#root-element>root element</a> and the <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute is not in a defined state
+   (i.e. it is not present or has an invalid value)</dt>
+
+   <dd><p><a href=#the-directionality>The directionality</a> of the element is '<a href=#concept-ltr title=concept-ltr>ltr</a>'.</dd>
+
+
+   <dt>If the element has a parent element and the <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute is not in a defined state
+   (i.e. it is not present or has an invalid value)</dt>
+
+   <dd><p><a href=#the-directionality>The directionality</a> of the element is the same
+   as the element's parent element's <a href=#the-directionality title="the
+   directionality">directionality</a>.</dd>
+
+
+  </dl><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>
+
   <hr><dl class=domintro><dt><var title="">document</var> . <code title=dom-dir><a href=#dom-dir>dir</a></code> [ = <var title="">value</var> ]</dt>
    <dd>
     <p>Returns <a href=#the-html-element>the <code>html</code> element</a>'s <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute's value, if any.</p>
-    <p>Can be set, to either "<code title="">ltr</code>" or "<code title="">rtl</code>", to replace <a href=#the-html-element>the <code>html</code> element</a>'s <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute's value.</p>
+    <p>Can be set, to either "<code title="">ltr</code>", "<code title="">rtl</code>", or "<code title="">auto</code>" to replace <a href=#the-html-element>the <code>html</code> element</a>'s <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute's value.</p>
     <p>If there is no <a href=#the-html-element title="the html element"><code>html</code> element</a>, returns the empty string and ignores new values.</p>
    </dd>
 
@@ -9690,6 +9776,7 @@
   by search engines).</p>
 
 
+
   <h5 id=classes><span class=secno>3.2.3.6 </span>The <dfn title=attr-class><code>class</code></dfn> attribute</h5>
 
   <p>Every <a href=#html-elements title="HTML elements">HTML element</a> may have a
@@ -19893,14 +19980,17 @@
    <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
    <dt>Content attributes:</dt>
    <dd><a href=#global-attributes>Global attributes</a></dd>
-   <!--XXX <dd>Also, the <code title="attr-dir">dir</code> global attribute has special semantics on this element.</dd>-->
+   <dd>Also, the <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> global attribute has special semantics on this element.</dd>
    <dt>DOM interface:</dt>
    <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
   </dl><p>The <code><a href=#the-bdi-element>bdi</a></code> element <a href=#represents>represents</a> a span of
   text that is to be isolated from its surroundings for the purposes
   of bidirectional text formatting. <a href=#refsBIDI>[BIDI]</a></p>
 
-  <!-- XXX once we have dir=auto, this element should default to dir=auto -->
+  <p class=note>The <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> global
+  attribute defaults to <code title=attr-dir-auto><a href=#attr-dir-auto>auto</a></code> on
+  this element (it never inherits from the parent element like with
+  other elements).</p>
 
   <div class=impl>
 
@@ -51434,6 +51524,27 @@
 
    </dd>
 
+
+   <dt><dfn id=selector-ltr title=selector-ltr><code>:ltr</code></dfn></dt>
+
+   <dd>
+
+    <p>The <code title=selector-ltr><a href=#selector-ltr>:ltr</a></code> pseudo-class must
+    match all elements whose <a href=#the-directionality title="the
+    directionality">directionality</a> is '<a href=#concept-ltr title=concept-ltr>ltr</a>'.</p>
+
+   </dd>
+
+   <dt><dfn id=selector-rtl title=selector-rtl><code>:rtl</code></dfn></dt>
+
+   <dd>
+
+    <p>The <code title=selector-rtl><a href=#selector-rtl>:rtl</a></code> pseudo-class must
+    match all elements whose <a href=#the-directionality title="the
+    directionality">directionality</a> is '<a href=#concept-rtl title=concept-rtl>rtl</a>'.</p>
+
+   </dd>
+
   </dl><p class=note>Another section of this specification defines the
   <i><a href=#target-element>target element</a></i> used with the <code title=selector-target>:target</code> pseudo-class.</p>
 
@@ -83413,15 +83524,6 @@
   expected to render parentheses around the text of <code><a href=#the-rt-element>rt</a></code>
   elements in the absence of <code><a href=#the-rp-element>rp</a></code> elements.</p>
 
-  <p>The <code><a href=#the-br-element>br</a></code> element is expected to render as if its
-  contents were a single U+000A LINE FEED (LF) character and its
-  'white-space' property was 'pre'. User agents are expected to
-  support the 'clear' property on inline elements (in order to render
-  <code><a href=#the-br-element>br</a></code> elements with <code title=attr-br-clear><a href=#attr-br-clear>clear</a></code> attributes) in the manner
-  described in the non-normative note to this effect in CSS2.1.</p>
-  <!-- section 9.5.2 of CSS2.1 -->
-  <!-- br { content: '\A'; } /* waiting for 'content' to apply to elements */ -->
-
   <p>The user agent is expected to hide <code><a href=#the-noscript-element>noscript</a></code> elements
   for whom <a href=#concept-n-script title=concept-n-script>scripting is enabled</a>,
   irrespective of CSS rules.</p>
@@ -83996,6 +84098,8 @@
 q:before { content: open-quote; }
 q:after { content: close-quote; }
 
+br { content: '\A'; white-space: pre; }
+
 nobr { white-space: nowrap; }
 listing, plaintext, pre, xmp { white-space: pre; }
 textarea { white-space: pre-wrap; }
@@ -84035,16 +84139,21 @@
 table { border-style: outset; }
 td, th { border-style: inset; }
 
-output { unicode-bidi: isolate; }
+:ltr { direction: ltr; }
+:rtl { direction: rtl; }
+[dir] { unicode-bidi: embed; }
+bdo, bdo[dir] { unicode-bidi: bidi-override; }
+bdi, output { unicode-bidi: isolate; }
+textarea[dir=auto], pre[dir=auto] { unicode-bidi: plaintext; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */</pre>
 
-[dir=ltr] { direction: ltr; unicode-bidi: embed; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
-[dir=rtl] { direction: rtl; unicode-bidi: embed; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
-bdo[dir=ltr], bdo[dir=rtl] { unicode-bidi: bidi-override; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
-bdi { unicode-bidi: isolate; }</pre>
+  <p>Rules setting the 'quotes' property appropriately for the locales
+  and languages understood by the user are expected to be present.</p>
 
-  <p>In addition, rules setting the 'quotes' property appropriately
-  for the locales and languages understood by the user are expected to
-  be present.</p>
+  <p>User agents are expected to
+  support the 'clear' property on inline elements (in order to render
+  <code><a href=#the-br-element>br</a></code> elements with <code title=attr-br-clear><a href=#attr-br-clear>clear</a></code> attributes) in the manner
+  described in the non-normative note to this effect in CSS2.1.</p>
+  <!-- section 9.5.2 of CSS2.1 -->
 
   <hr><p id=decohints>The following rules are also expected to apply, as
   <a href=#presentational-hints>presentational hints</a>:</p>

Modified: index
===================================================================
--- index	2010-11-05 20:10:49 UTC (rev 5671)
+++ index	2010-11-09 00:57:59 UTC (rev 5672)
@@ -218,7 +218,7 @@
 
   <header class=head id=head><p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
    <hgroup><h1>HTML5 (including next generation additions still in development)</h1>
-    <h2 class="no-num no-toc">Draft Standard — 5 November 2010</h2>
+    <h2 class="no-num no-toc">Draft Standard — 9 November 2010</h2>
    </hgroup><p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
    <p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
    <!--<p class="impl"><strong>Implementors!</strong> We have a <a href="http://www.whatwg.org/mailing-list#implementors">mailing list</a> for you too!</p>-->
@@ -9607,41 +9607,127 @@
 
   <p>The <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute specifies the
   element's text directionality. The attribute is an <a href=#enumerated-attribute>enumerated
-  attribute</a> with the keyword <code title="">ltr</code> mapping
-  to the state <i>ltr</i>, and the keyword <code title="">rtl</code>
-  mapping to the state <i>rtl</i>. The attribute has no <i>invalid
-  value default</i> and no <i>missing value default</i>.</p>
+  attribute</a> with the following keywords and states:</p>
 
-  <div class=impl>
+  <dl><dt>The <dfn id=attr-dir-ltr title=attr-dir-ltr><code>ltr</code></dfn> keyword, which maps to the <dfn id=attr-dir-ltr-state title=attr-dir-ltr-state>ltr</dfn> state</dt>
 
-  <p>The processing of this attribute is primarily performed by 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>
+   <dd>
 
-  </div>
+    <p>Indicates that the contents of the element are explicitly
+    directionally embedded left-to-right text.</p>
 
-  <p><dfn id=the-directionality>The directionality</dfn> of an element, which is used in
-  particular by the <code><a href=#the-canvas-element>canvas</a></code> element's text rendering API,
-  is either 'ltr' or 'rtl'. If the user agent supports CSS and the
-  'direction' property on this element has a computed value of either
-  'ltr' or 'rtl', then that is <a href=#the-directionality>the directionality</a> of the
-  element. Otherwise, if the element is <a href=#being-rendered>being rendered</a>,
-  then <a href=#the-directionality>the directionality</a> of the element is the
-  directionality used by the presentation layer, potentially
-  determined from the value of the <code title=attr-dir><a href=#the-dir-attribute>dir</a></code>
-  attribute on the element. Otherwise, if the element's <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute has the state <i>ltr</i>, the
-  element's directionality is 'ltr' (left-to-right); if the attribute
-  has the state <i>rtl</i>, the element's directionality is 'rtl'
-  (right-to-left); and otherwise, the element's directionality is the
-  same as its parent element, or 'ltr' if there is no parent
-  element.</p>
+   </dd>
 
+   <dt>The <dfn id=attr-dir-rtl title=attr-dir-rtl><code>rtl</code></dfn> keyword, which maps to the <dfn id=attr-dir-rtl-state title=attr-dir-rtl-state>rtl</dfn> state</dt>
+
+   <dd>
+
+    <p>Indicates that the contents of the element are explicitly
+    directionally embedded right-to-left text.</p>
+
+   </dd>
+
+   <dt>The <dfn id=attr-dir-auto title=attr-dir-auto><code>auto</code></dfn> keyword, which maps to the <dfn id=attr-dir-auto-state title=attr-dir-auto-state>auto</dfn> state</dt>
+
+   <dd>
+
+    <p>Indicates that the contents of the element are explicitly
+    embedded text, but that the direction is to be determined
+    programmatically using the contents of the element (as described
+    below).</p>
+
+    <p class=note>The heuristic used by this state is very crude (it
+    just looks at the first character with a strong directionality, in
+    a manner analogous to the Paragraph Level determination in the
+    bidirectional algorithm). Authors are urged to only use this value
+    as a last resort when the direction of the text is truly unknown
+    and no better server-side heuristic can be applied.</p>
+
+   </dd>
+
+  </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 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>
+
+  <dl class=switch><dt>If the element's <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute is
+   in the <a href=#attr-dir-ltr-state title=attr-dir-ltr-state>ltr</a> state</dt>
+
+   <dd><p><a href=#the-directionality>The directionality</a> of the element is '<a href=#concept-ltr title=concept-ltr>ltr</a>'.</dd>
+
+
+   <dt>If the element's <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute is
+   in the <a href=#attr-dir-rtl-state title=attr-dir-rtl-state>rtl</a> state</dt>
+
+   <dd><p><a href=#the-directionality>The directionality</a> of the element is '<a href=#concept-rtl title=concept-rtl>rtl</a>'.</dd>
+
+
+   <dt>If 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>
+
+   <dt>If the element is a <code><a href=#the-bdi-element>bdi</a></code> element and the <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute is not in a defined state
+   (i.e. it is not present or has an invalid value)</dt>
+
+   <dd>
+
+    <p>Find the first character in <a href=#tree-order>tree order</a> that
+    matches the following criteria:</p>
+
+    <ul><li><p>The character is from a <a href=#text-node>text node</a> that is a
+     descendant of the element whose <a href=#the-directionality title="the
+     directionality">directionality</a> is being
+     determined.</li>
+
+     <li><p>The character is of bidirectional character type L, AL,
+     or R. <a href=#refsBIDI>[BIDI]</a></li>
+
+     <li>
+
+      <p>The character is not in a text node that has an ancestor
+      element that is a descendant of the element whose <a href=#the-directionality title="the directionality">directionality</a> is being
+      determined and that is either:</p>
+
+      <ul class=brief><li>A <code><a href=#script>script</a></code> element.
+       <li>A <code><a href=#the-style-element>style</a></code> element.
+       <li>An element with a <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute in a defined state.
+      </ul></li>
+
+    </ul><p>If such a character is found and it is of bidirectional
+    character type AL or R, <a href=#the-directionality>the directionality</a> of the
+    element is '<a href=#concept-rtl title=concept-rtl>rtl</a>'.</p>
+
+    <p>Otherwise, <a href=#the-directionality>the directionality</a> of the element is
+    '<a href=#concept-ltr title=concept-ltr>ltr</a>'.</p>
+
+   </dd>
+
+
+
+   <dt>If the element is a <a href=#root-element>root element</a> and the <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute is not in a defined state
+   (i.e. it is not present or has an invalid value)</dt>
+
+   <dd><p><a href=#the-directionality>The directionality</a> of the element is '<a href=#concept-ltr title=concept-ltr>ltr</a>'.</dd>
+
+
+   <dt>If the element has a parent element and the <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute is not in a defined state
+   (i.e. it is not present or has an invalid value)</dt>
+
+   <dd><p><a href=#the-directionality>The directionality</a> of the element is the same
+   as the element's parent element's <a href=#the-directionality title="the
+   directionality">directionality</a>.</dd>
+
+
+  </dl><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>
+
   <hr><dl class=domintro><dt><var title="">document</var> . <code title=dom-dir><a href=#dom-dir>dir</a></code> [ = <var title="">value</var> ]</dt>
    <dd>
     <p>Returns <a href=#the-html-element>the <code>html</code> element</a>'s <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute's value, if any.</p>
-    <p>Can be set, to either "<code title="">ltr</code>" or "<code title="">rtl</code>", to replace <a href=#the-html-element>the <code>html</code> element</a>'s <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute's value.</p>
+    <p>Can be set, to either "<code title="">ltr</code>", "<code title="">rtl</code>", or "<code title="">auto</code>" to replace <a href=#the-html-element>the <code>html</code> element</a>'s <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute's value.</p>
     <p>If there is no <a href=#the-html-element title="the html element"><code>html</code> element</a>, returns the empty string and ignores new values.</p>
    </dd>
 
@@ -9667,6 +9753,7 @@
   by search engines).</p>
 
 
+
   <h5 id=classes><span class=secno>3.2.3.6 </span>The <dfn title=attr-class><code>class</code></dfn> attribute</h5>
 
   <p>Every <a href=#html-elements title="HTML elements">HTML element</a> may have a
@@ -19870,14 +19957,17 @@
    <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
    <dt>Content attributes:</dt>
    <dd><a href=#global-attributes>Global attributes</a></dd>
-   <!--XXX <dd>Also, the <code title="attr-dir">dir</code> global attribute has special semantics on this element.</dd>-->
+   <dd>Also, the <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> global attribute has special semantics on this element.</dd>
    <dt>DOM interface:</dt>
    <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
   </dl><p>The <code><a href=#the-bdi-element>bdi</a></code> element <a href=#represents>represents</a> a span of
   text that is to be isolated from its surroundings for the purposes
   of bidirectional text formatting. <a href=#refsBIDI>[BIDI]</a></p>
 
-  <!-- XXX once we have dir=auto, this element should default to dir=auto -->
+  <p class=note>The <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> global
+  attribute defaults to <code title=attr-dir-auto><a href=#attr-dir-auto>auto</a></code> on
+  this element (it never inherits from the parent element like with
+  other elements).</p>
 
   <div class=impl>
 
@@ -51414,6 +51504,27 @@
 
    </dd>
 
+
+   <dt><dfn id=selector-ltr title=selector-ltr><code>:ltr</code></dfn></dt>
+
+   <dd>
+
+    <p>The <code title=selector-ltr><a href=#selector-ltr>:ltr</a></code> pseudo-class must
+    match all elements whose <a href=#the-directionality title="the
+    directionality">directionality</a> is '<a href=#concept-ltr title=concept-ltr>ltr</a>'.</p>
+
+   </dd>
+
+   <dt><dfn id=selector-rtl title=selector-rtl><code>:rtl</code></dfn></dt>
+
+   <dd>
+
+    <p>The <code title=selector-rtl><a href=#selector-rtl>:rtl</a></code> pseudo-class must
+    match all elements whose <a href=#the-directionality title="the
+    directionality">directionality</a> is '<a href=#concept-rtl title=concept-rtl>rtl</a>'.</p>
+
+   </dd>
+
   </dl><p class=note>Another section of this specification defines the
   <i><a href=#target-element>target element</a></i> used with the <code title=selector-target>:target</code> pseudo-class.</p>
 
@@ -79327,15 +79438,6 @@
   expected to render parentheses around the text of <code><a href=#the-rt-element>rt</a></code>
   elements in the absence of <code><a href=#the-rp-element>rp</a></code> elements.</p>
 
-  <p>The <code><a href=#the-br-element>br</a></code> element is expected to render as if its
-  contents were a single U+000A LINE FEED (LF) character and its
-  'white-space' property was 'pre'. User agents are expected to
-  support the 'clear' property on inline elements (in order to render
-  <code><a href=#the-br-element>br</a></code> elements with <code title=attr-br-clear><a href=#attr-br-clear>clear</a></code> attributes) in the manner
-  described in the non-normative note to this effect in CSS2.1.</p>
-  <!-- section 9.5.2 of CSS2.1 -->
-  <!-- br { content: '\A'; } /* waiting for 'content' to apply to elements */ -->
-
   <p>The user agent is expected to hide <code><a href=#the-noscript-element>noscript</a></code> elements
   for whom <a href=#concept-n-script title=concept-n-script>scripting is enabled</a>,
   irrespective of CSS rules.</p>
@@ -79910,6 +80012,8 @@
 q:before { content: open-quote; }
 q:after { content: close-quote; }
 
+br { content: '\A'; white-space: pre; }
+
 nobr { white-space: nowrap; }
 listing, plaintext, pre, xmp { white-space: pre; }
 textarea { white-space: pre-wrap; }
@@ -79949,16 +80053,21 @@
 table { border-style: outset; }
 td, th { border-style: inset; }
 
-output { unicode-bidi: isolate; }
+:ltr { direction: ltr; }
+:rtl { direction: rtl; }
+[dir] { unicode-bidi: embed; }
+bdo, bdo[dir] { unicode-bidi: bidi-override; }
+bdi, output { unicode-bidi: isolate; }
+textarea[dir=auto], pre[dir=auto] { unicode-bidi: plaintext; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */</pre>
 
-[dir=ltr] { direction: ltr; unicode-bidi: embed; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
-[dir=rtl] { direction: rtl; unicode-bidi: embed; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
-bdo[dir=ltr], bdo[dir=rtl] { unicode-bidi: bidi-override; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
-bdi { unicode-bidi: isolate; }</pre>
+  <p>Rules setting the 'quotes' property appropriately for the locales
+  and languages understood by the user are expected to be present.</p>
 
-  <p>In addition, rules setting the 'quotes' property appropriately
-  for the locales and languages understood by the user are expected to
-  be present.</p>
+  <p>User agents are expected to
+  support the 'clear' property on inline elements (in order to render
+  <code><a href=#the-br-element>br</a></code> elements with <code title=attr-br-clear><a href=#attr-br-clear>clear</a></code> attributes) in the manner
+  described in the non-normative note to this effect in CSS2.1.</p>
+  <!-- section 9.5.2 of CSS2.1 -->
 
   <hr><p id=decohints>The following rules are also expected to apply, as
   <a href=#presentational-hints>presentational hints</a>:</p>

Modified: source
===================================================================
--- source	2010-11-05 20:10:49 UTC (rev 5671)
+++ source	2010-11-09 00:57:59 UTC (rev 5672)
@@ -9758,38 +9758,148 @@
 
   <p>The <code title="attr-dir">dir</code> attribute specifies the
   element's text directionality. The attribute is an <span>enumerated
-  attribute</span> with the keyword <code title="">ltr</code> mapping
-  to the state <i>ltr</i>, and the keyword <code title="">rtl</code>
-  mapping to the state <i>rtl</i>. The attribute has no <i>invalid
-  value default</i> and no <i>missing value default</i>.</p>
+  attribute</span> with the following keywords and states:</p>
 
-  <div class="impl">
+  <dl>
 
-  <p>The processing of this attribute is primarily performed by 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>
+   <dt>The <dfn title="attr-dir-ltr"><code>ltr</code></dfn> keyword, which maps to the <dfn title="attr-dir-ltr-state">ltr</dfn> state</dt>
 
-  </div>
+   <dd>
 
-  <p><dfn>The directionality</dfn> of an element, which is used in
-  particular by the <code>canvas</code> element's text rendering API,
-  is either 'ltr' or 'rtl'. If the user agent supports CSS and the
-  'direction' property on this element has a computed value of either
-  'ltr' or 'rtl', then that is <span>the directionality</span> of the
-  element. Otherwise, if the element is <span>being rendered</span>,
-  then <span>the directionality</span> of the element is the
-  directionality used by the presentation layer, potentially
-  determined from the value of the <code title="attr-dir">dir</code>
-  attribute on the element. Otherwise, if the element's <code
-  title="attr-dir">dir</code> attribute has the state <i>ltr</i>, the
-  element's directionality is 'ltr' (left-to-right); if the attribute
-  has the state <i>rtl</i>, the element's directionality is 'rtl'
-  (right-to-left); and otherwise, the element's directionality is the
-  same as its parent element, or 'ltr' if there is no parent
-  element.</p>
+    <p>Indicates that the contents of the element are explicitly
+    directionally embedded left-to-right text.</p>
 
+   </dd>
+
+   <dt>The <dfn title="attr-dir-rtl"><code>rtl</code></dfn> keyword, which maps to the <dfn title="attr-dir-rtl-state">rtl</dfn> state</dt>
+
+   <dd>
+
+    <p>Indicates that the contents of the element are explicitly
+    directionally embedded right-to-left text.</p>
+
+   </dd>
+
+   <dt>The <dfn title="attr-dir-auto"><code>auto</code></dfn> keyword, which maps to the <dfn title="attr-dir-auto-state">auto</dfn> state</dt>
+
+   <dd>
+
+    <p>Indicates that the contents of the element are explicitly
+    embedded text, but that the direction is to be determined
+    programmatically using the contents of the element (as described
+    below).</p>
+
+    <p class="note">The heuristic used by this state is very crude (it
+    just looks at the first character with a strong directionality, in
+    a manner analogous to the Paragraph Level determination in the
+    bidirectional algorithm). Authors are urged to only use this value
+    as a last resort when the direction of the text is truly unknown
+    and no better server-side heuristic can be applied.</p>
+
+   </dd>
+
+  </dl>
+
+  <p>The attribute has no <i>invalid value default</i> and no
+  <i>missing value default</i>.</p>
+
+  <p><dfn>The directionality</dfn> of an element is either '<dfn
+  title="concept-ltr">ltr</dfn>' or '<dfn
+  title="concept-rtl">rtl</dfn>', and is determined as per the first
+  appropriate set of steps from the following list:</p>
+
+  <dl class="switch">
+
+
+   <dt>If the element's <code title="attr-dir">dir</code> attribute is
+   in the <span title="attr-dir-ltr-state">ltr</span> state</dt>
+
+   <dd><p><span>The directionality</span> of the element is '<span
+   title="concept-ltr">ltr</span>'.</p></dd>
+
+
+   <dt>If the element's <code title="attr-dir">dir</code> attribute is
+   in the <span title="attr-dir-rtl-state">rtl</span> state</dt>
+
+   <dd><p><span>The directionality</span> of the element is '<span
+   title="concept-rtl">rtl</span>'.</p></dd>
+
+
+   <dt>If the element's <code title="attr-dir">dir</code> attribute is
+   in the <span title="attr-dir-auto-state">auto</span> state</dt>
+
+   <dt>If the element is a <code>bdi</code> element and the <code
+   title="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>Find the first character in <span>tree order</span> that
+    matches the following criteria:</p>
+
+    <ul>
+
+     <li><p>The character is from a <span>text node</span> that is a
+     descendant of the element whose <span title="the
+     directionality">directionality</span> is being
+     determined.</p></li>
+
+     <li><p>The character is of bidirectional character type L, AL,
+     or R. <a href="#refsBIDI">[BIDI]</a></li>
+
+     <li>
+
+      <p>The character is not in a text node that has an ancestor
+      element that is a descendant of the element whose <span
+      title="the directionality">directionality</span> is being
+      determined and that is either:</p>
+
+      <ul class="brief">
+       <li>A <code>script</code> element.
+       <li>A <code>style</code> element.
+       <li>An element with a <code title="attr-dir">dir</code> attribute in a defined state.
+      </ul>
+
+     </li>
+
+    </ul>
+
+    <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 title="concept-rtl">rtl</span>'.</p>
+
+    <p>Otherwise, <span>the directionality</span> of the element is
+    '<span title="concept-ltr">ltr</span>'.</p>
+
+   </dd>
+
+
+
+   <dt>If the element is a <span>root element</span> and the <code
+   title="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
+   title="concept-ltr">ltr</span>'.</p></dd>
+
+
+   <dt>If the element has a parent element and the <code
+   title="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 title="the
+   directionality">directionality</span>.</p></dd>
+
+
+  </dl>
+
+  <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>
+
   <hr>
 
   <dl class="domintro">
@@ -9797,7 +9907,7 @@
    <dt><var title="">document</var> . <code title="dom-dir">dir</code> [ = <var title="">value</var> ]</dt>
    <dd>
     <p>Returns <span>the <code>html</code> element</span>'s <code title="attr-dir">dir</code> attribute's value, if any.</p>
-    <p>Can be set, to either "<code title="">ltr</code>" or "<code title="">rtl</code>", to replace <span>the <code>html</code> element</span>'s <code title="attr-dir">dir</code> attribute's value.</p>
+    <p>Can be set, to either "<code title="">ltr</code>", "<code title="">rtl</code>", or "<code title="">auto</code>" to replace <span>the <code>html</code> element</span>'s <code title="attr-dir">dir</code> attribute's value.</p>
     <p>If there is no <span title="the html element"><code>html</code> element</span>, returns the empty string and ignores new values.</p>
    </dd>
 
@@ -9827,6 +9937,7 @@
   by search engines).</p>
 
 
+
   <h5 id="classes">The <dfn title="attr-class"><code>class</code></dfn> attribute</h5>
 
   <p>Every <span title="HTML elements">HTML element</span> may have a
@@ -21202,7 +21313,7 @@
    <dd><span>Phrasing content</span>.</dd>
    <dt>Content attributes:</dt>
    <dd><span>Global attributes</span></dd>
-   <!--XXX <dd>Also, the <code title="attr-dir">dir</code> global attribute has special semantics on this element.</dd>-->
+   <dd>Also, the <code title="attr-dir">dir</code> global attribute has special semantics on this element.</dd>
    <dt>DOM interface:</dt>
    <dd>Uses <code>HTMLElement</code>.</dd>
   </dl>
@@ -21211,7 +21322,10 @@
   text that is to be isolated from its surroundings for the purposes
   of bidirectional text formatting. <a href="#refsBIDI">[BIDI]</a></p>
 
-  <!-- XXX once we have dir=auto, this element should default to dir=auto -->
+  <p class="note">The <code title="attr-dir">dir</code> global
+  attribute defaults to <code title="attr-dir-auto">auto</code> on
+  this element (it never inherits from the parent element like with
+  other elements).</p>
 
   <div class="impl">
 
@@ -57936,6 +58050,29 @@
 
    </dd>
 
+
+   <dt><dfn title="selector-ltr"><code>:ltr</code></dfn></dt>
+
+   <dd>
+
+    <p>The <code title="selector-ltr">:ltr</code> pseudo-class must
+    match all elements whose <span title="the
+    directionality">directionality</span> is '<span
+    title="concept-ltr">ltr</span>'.</p>
+
+   </dd>
+
+   <dt><dfn title="selector-rtl"><code>:rtl</code></dfn></dt>
+
+   <dd>
+
+    <p>The <code title="selector-rtl">:rtl</code> pseudo-class must
+    match all elements whose <span title="the
+    directionality">directionality</span> is '<span
+    title="concept-rtl">rtl</span>'.</p>
+
+   </dd>
+
   </dl>
 
   <p class="note">Another section of this specification defines the
@@ -95567,16 +95704,6 @@
   expected to render parentheses around the text of <code>rt</code>
   elements in the absence of <code>rp</code> elements.</p>
 
-  <p>The <code>br</code> element is expected to render as if its
-  contents were a single U+000A LINE FEED (LF) character and its
-  'white-space' property was 'pre'. User agents are expected to
-  support the 'clear' property on inline elements (in order to render
-  <code>br</code> elements with <code
-  title="attr-br-clear">clear</code> attributes) in the manner
-  described in the non-normative note to this effect in CSS2.1.</p>
-  <!-- section 9.5.2 of CSS2.1 -->
-  <!-- br { content: '\A'; } /* waiting for 'content' to apply to elements */ -->
-
   <p>The user agent is expected to hide <code>noscript</code> elements
   for whom <span title="concept-n-script">scripting is enabled</span>,
   irrespective of CSS rules.</p>
@@ -96260,6 +96387,8 @@
 q:before { content: open-quote; }
 q:after { content: close-quote; }
 
+br { content: '\A'; white-space: pre; }
+
 nobr { white-space: nowrap; }
 listing, plaintext, pre, xmp { white-space: pre; }
 textarea { white-space: pre-wrap; }
@@ -96299,16 +96428,22 @@
 table { border-style: outset; }
 td, th { border-style: inset; }
 
-output { unicode-bidi: isolate; }
+:ltr { direction: ltr; }
+:rtl { direction: rtl; }
+[dir] { unicode-bidi: embed; }
+bdo, bdo[dir] { unicode-bidi: bidi-override; }
+bdi, output { unicode-bidi: isolate; }
+textarea[dir=auto], pre[dir=auto] { unicode-bidi: plaintext; } /* <a href="#case-insensitive-selector-exception">case-insensitive</a> */</pre>
 
-[dir=ltr] { direction: ltr; unicode-bidi: embed; } /* <a href="#case-insensitive-selector-exception">case-insensitive</a> */
-[dir=rtl] { direction: rtl; unicode-bidi: embed; } /* <a href="#case-insensitive-selector-exception">case-insensitive</a> */
-bdo[dir=ltr], bdo[dir=rtl] { unicode-bidi: bidi-override; } /* <a href="#case-insensitive-selector-exception">case-insensitive</a> */
-bdi { unicode-bidi: isolate; }</pre>
+  <p>Rules setting the 'quotes' property appropriately for the locales
+  and languages understood by the user are expected to be present.</p>
 
-  <p>In addition, rules setting the 'quotes' property appropriately
-  for the locales and languages understood by the user are expected to
-  be present.</p>
+  <p>User agents are expected to
+  support the 'clear' property on inline elements (in order to render
+  <code>br</code> elements with <code
+  title="attr-br-clear">clear</code> attributes) in the manner
+  described in the non-normative note to this effect in CSS2.1.</p>
+  <!-- section 9.5.2 of CSS2.1 -->
 
   <hr>
 




More information about the Commit-Watchers mailing list