Re: 'dir' attribute on BIDI inline elements and actual browsers

Orion Adrian wrote:

> Given the intervening period between

> <span dir="rtl">&#1506;&#1489;&#1512;&#1497;&#1514;2</span>

> and

> <span dir="rtl">&#1506;&#1489;&#1512;&#1497;&#1514;3</span>

> that inherits its parents text direction (ltr) shouldn't 2 be the
> correct rendering?

Exactly this is the question of this diskussion.

Unfortunately the HTML specs are not precise enough:

http://www.w3.org/TR/html401/struct/dirlang.html#h-8.2

----begin of quote----
When the dir attribute is set for a block-level element, it remains in 
effect for the duration of the element and any nested block-level 
elements. Setting the dir attribute on a nested element overrides the 
inherited value.
[...]
Inline elements, on the other hand, do not inherit the dir attribute. 
This means that an inline element without a dir attribute does not open 
an additional level of embedding with respect to the bidirectional 
algorithm.
----end of quote----

> What would be the correct rendering for:

> <p>English1 <span dir="rtl">&#1506;&#1489;&#1512;&#1497;&#1514;2</span>
> English 2.5 <span
> dir="rtl">&#1506;&#1489;&#1512;&#1497;&#1514;3</span> Englisch4.</p>

In this case the spans are not needed, because the digits (numerical 
characters) are part of the Hebrew or English words, or part of the 
English sentence ('2.5'). But, surprise, Konqueror makes a difference, 
which is a bug of Konqueror (also in other cases of digit/BIDI).
Conclusion: In this case explicit 'dir' would not be necessary, but weak 
  browsers make it necessary. Please note, that the digit-bug has 
nothing to do with [1] versus [2].

> or are there special cases for punctuation?

Yes, punctuation is mostly 'neutral' in direction, and follows the 
direction of the surrounding characters. The Unicode Bidi algorithm can 
not know, if e.g. a '.' is part of a word, a phrase, or the end of a 
sentence, but tries to guess the 'best'. This needs to force the 
direction with 'dir' in special cases, e.g. mixed phrases in mixed 
sententes, puntuation and spaces, numbers.

Helmut Wollmersdorfer

Received on Wednesday, 20 December 2006 16:03:50 UTC