This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 18339 - When the parent element is not an HTML element, what directionality is inherited?
Summary: When the parent element is not an HTML element, what directionality is inheri...
Status: RESOLVED WORKSFORME
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-20 00:44 UTC by contributor
Modified: 2012-10-31 23:28 UTC (History)
6 users (show)

See Also:


Attachments

Description contributor 2012-07-20 00:44:53 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html
Multipage: http://www.whatwg.org/C#the-dir-attribute
Complete: http://www.whatwg.org/c#the-dir-attribute

Comment:
When the parent element is not an HTML element, the directionality of the
child should default to LTR

Posted from: 66.207.208.98 by bzbarsky@mit.edu
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:17.0) Gecko/17.0 Firefox/17.0
Comment 1 Boris Zbarsky 2012-07-20 00:45:28 UTC
Unless, of course, the spec defines directionality as a binary thing on all elements, not just HTML elements.  In which case it might be good to explicitly call that out.
Comment 2 Aharon Lanin 2012-07-25 06:47:01 UTC
(In reply to comment #1)
> Unless, of course, the spec defines directionality as a binary thing on all
> elements, not just HTML elements.  In which case it might be good to explicitly
> call that out.

I think directionality should work the same regardless of whether an element is defined in HTML or not. Making it do something different (e.g. defaulting to LTR for the element or its children) would break existing pages. Even if there were no existing RTL pages using non-HTML elements (which there certainly are), I do not see any utility in making the directionality of non-HTML elements work differently.
Comment 3 Boris Zbarsky 2012-07-25 17:02:11 UTC
I would be fine with that, personally, as comment 1 says.
Comment 4 fantasai 2012-08-25 01:13:34 UTC
So the bug here isn't "When the parent element is not an HTML element, the directionality of the child should default to LTR.", it's "HTML doesn't define what happens when the parent of an element is not an HTML element".

An element can have
  - LTR directionality
  - RTL directionality
  - no directionality
http://www.w3.org/TR/selectors4/#the-dir-pseudo

There are various possibilities, here are the three I can think of:

  - All elements, whether they are HTML or not, have a directionality.

  - Non-HTML elements do not have a directionality, but directionality
    inherits through them. (This would be represented by two binary
    states: whether the element is LTR or RTL, and whether the element
    has a directionality or no.)

  - As bz proposed, HTML children of elements without a directionality
    inherit LTR.
Comment 5 Aharon Lanin 2012-08-27 15:11:44 UTC
(In reply to comment #4)
> An element can have
>   - LTR directionality
>   - RTL directionality
>   - no directionality
> http://www.w3.org/TR/selectors4/#the-dir-pseudo

I do not see where the link above or the current HTML5 spec say that an element can have no directionality. As far as I understand, it is always either LTR or RTL.

> 
> There are various possibilities, here are the three I can think of:
> 
>   - All elements, whether they are HTML or not, have a directionality.

And, presumably, it is inherited from the parent if not set through an explicit dir attribute. This seems like the obvious approach to me.

> 
>   - Non-HTML elements do not have a directionality, but directionality
>     inherits through them. (This would be represented by two binary
>     states: whether the element is LTR or RTL, and whether the element
>     has a directionality or no.)

What would be the utility of having such a fine distinction?

> 
>   - As bz proposed, HTML children of elements without a directionality
>     inherit LTR.

But this would break current RTL pages that use non-HTML elements. And it would mean that, by default, the children would have LTR directionality but RTL direction (when the grandfather is RTL). Seems like a big mess to me.
Comment 6 Aharon Lanin 2012-08-27 15:49:26 UTC
(In reply to comment #5)
> (In reply to comment #4)
> >   - As bz proposed, HTML children of elements without a directionality
> >     inherit LTR.
> 
> But this would break current RTL pages that use non-HTML elements. And it would
> mean that, by default, the children would have LTR directionality but RTL
> direction (when the grandfather is RTL). Seems like a big mess to me.


Sorry, the connector should have been "Or", not "And". That is, let's say that we decide that the span in

<div dir="rtl"><foo><span>...</span></foo></div>

should have LTR directionality. If, in the absence of custom CSS rules, it simultaneously gets direction:rtl, we have a mess, and if it has direction:ltr, we have a lack of backward compatibility.

And I still do not understand the rationale for this proposal.
Comment 7 Ian 'Hixie' Hickson 2012-10-31 23:28:35 UTC
As far as I can tell, this was already defined. However, I've tried to make it clearer. Let me know if it's still ambiguous or if I missed the point here.
Comment 8 contributor 2012-10-31 23:28:47 UTC
Checked in as WHATWG revision r7495.
Check-in comment: Clarify that 'directionality' applies to all elements.
http://html5.org/tools/web-apps-tracker?from=7494&to=7495