Closed Bug 300270 Opened 20 years ago Closed 20 years ago

GetDir() always returns empty string

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
major

Tracking

()

RESOLVED FIXED
mozilla1.8beta4

People

(Reporter: smontagu, Assigned: smontagu)

References

()

Details

(Keywords: fixed1.8, regression)

Attachments

(1 file)

The testcase in the URL field should alert "foo.dir=rtl", and does so in 1.7.8. In trunk it alerts "foo.dir=". I believe this is regression from bug 236476.
Attached patch PatchSplinter Review
One-line fix
Attachment #188842 - Flags: superreview?(jst)
Attachment #188842 - Flags: review?(bugmail)
This will break half the bidi-enabled web apps in the world (all those that use the dir attribute on specific elements instead of document.dir or style).
Flags: blocking1.8b4?
Flags: blocking-aviary1.1?
Is there a reason not to let GetDir return 'somevalue' for markup like <div dir='somevalue'> ? If that is ok you can just replace the entire function with return GetAttrHelper(nsHTMLAtoms::dir, aValue)
The trouble with returning 'somevalue' is that typically applications will do something like if (foo.dir == 'ltr' || foo.dir == '') // no value set, default to ltr // do ltr stuff else // do rtl stuff so the 'somevalue' case will be treated as rtl. The smart thing to do is if (foo.dir != 'rtl') // do ltr stuff else // do rtl stuff but I haven't seen that very often.
That's only a problem if the markup actually contains 'somevalue' though. Reading the bug that regressed this it seems like IE does not return 'somevalue', though for the sake of consistency i'd think it'd be nice to do that. Unless it's a problem on realworld sites of course.
Blocks: 151407
Comment on attachment 188842 [details] [diff] [review] Patch r=me if you really do think that sites would break if we returned 'somevalue'. But i'd prefer to do comment 3
Attachment #188842 - Flags: review?(bugmail) → review+
This is gonna need to make b4 if it's gonna make 1.1 so the 1.1 nomination is redundant.
Flags: blocking-aviary1.1?
Flags: blocking1.8b4? → blocking1.8b4+
Severity: normal → major
Keywords: regression
Whiteboard: [needs review jst]
Target Milestone: --- → mozilla1.8beta4
Flags: blocking1.8b5+
Comment on attachment 188842 [details] [diff] [review] Patch sr=jst
Attachment #188842 - Flags: superreview?(jst) → superreview+
Can we get this checked in on trunk to bake, then nominated for the branch?
Checked in to trunk.
Whiteboard: [needs review jst] → fixed on trunk
Comment on attachment 188842 [details] [diff] [review] Patch See comment 2. This is a serious regression for bidi web apps.
Attachment #188842 - Flags: approval1.8b4?
Attachment #188842 - Flags: approval1.8b4? → approval1.8b4+
Checking in nsGenericHTMLElement.cpp; /cvsroot/mozilla/content/html/content/src/nsGenericHTMLElement.cpp,v <-- nsGenericHTMLElement.cpp new revision: 1.596.2.2; previous revision: 1.596.2.1 done
Status: NEW → RESOLVED
Closed: 20 years ago
Keywords: fixed1.8
Resolution: --- → FIXED
Whiteboard: fixed on trunk
I've now specced this in HTML5 to match IE: http://www.whatwg.org/specs/web-apps/current-work/#dir See the last paragraph (and follow the links therein).
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: