- From: Andrew Fedoniouk <news@terrainformatica.com>
- Date: Sat, 29 May 2010 14:40:51 -0700
- To: "Zack Weinberg" <zweinberg@mozilla.com>
- Cc: HåkonWiumLie <howcome@opera.com>, <www-style@w3.org>
-------------------------------------------------- From: "Zack Weinberg" <zweinberg@mozilla.com> Sent: Saturday, May 29, 2010 2:03 PM To: "Andrew Fedoniouk" <news@terrainformatica.com> Cc: "HåkonWiumLie" <howcome@opera.com>; <www-style@w3.org> Subject: Re: [css3-text-layout] New editor's draft - margin-before/after/start/end etc. > "Andrew Fedoniouk" <news@terrainformatica.com> wrote: >> >> Correct, "dir" is a DOM attribute here. >> >> Precise algorithm of determination of :ltr,:rtl and :ttb values is >> this: Start from the element itself and walk through child-parent >> chain until you will find DOM element with defined "dir" attribute. >> If value of the "dir" is "rtl" then set :rtl to true and reset all >> other directionality pseudo-classes like :ltr and :ttb. > > Consider the complete HTML5 document > > <!doctype html> > <p>This text is mostly in English, but contains a Hebrew > quotation: <q>אבגabcדה</q>. There is an English word embedded > in the quotation.</p> > > What, if anything, would be matched by :ltr here? :rtl? Why, or why > not? The document you've provided does not contain any explicit "dir" declaration so neither :ltr nor :rtl is true. UA may or may not set implicit @dir value for the content depending on OS directionality but it is up to UA I think. In practical UI applications (e.g. this one http://en.wikipedia.org/wiki/Norton_Internet_Security ) we use explicit @dir declarations. > > Does your answer change if the Unicode explicit directional codes > (U+202A through U+202E) appear anywhere in the document, either as HTML > entities or as literal characters? > > Does your answer change if the right-to-left characters are not > well-nested relative to element boundaries, e.g. <q>אבגabcד</q>ה ? > I don't think that guessing :rtl or :ltr values by using particular character runs is a good idea at all. E.g. there is a task of presenting file names or URLs in UI. Think about file name in e.g. Hebrew but with ".htm" extension. Usually this is treated as <div dir="ltr"> so overall directionality is still LTR. To be short: :ltr and :rtl are explicitly @dir based. Is this the answer? -- Andrew Fedoniouk http://terrainformatica.com
Received on Saturday, 29 May 2010 21:41:24 UTC