Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#8367 closed defect (fixed)

dojo._isBodyLtr does not work with dojo.withGlobal

Reported by: Douglas Hays Owned by: Douglas Hays
Priority: high Milestone: 1.3
Component: Internationalization Version: 1.2.3
Keywords: Cc:
Blocked By: Blocking:

Description

When I call dojo.withGlobal to switch to a different document context, the value of dojo._bodyLtr is cached and can report the wrong value. The value should be cached somewhere related to the context like dojo.global._bodyLtr. I need this fixed for some doctype/rtl switching tests that I'm developing.

Attachments (2)

bodyltr.patch (627 bytes) - added by Douglas Hays 10 years ago.
possible patch
window-reduction.patch (2.7 KB) - added by Adam Peller 10 years ago.
forgot to attach this one... needs review

Download all attachments as: .zip

Change History (11)

Changed 10 years ago by Douglas Hays

Attachment: bodyltr.patch added

possible patch

comment:1 Changed 10 years ago by Adam Peller

I don't think we want to add any globals. It violates our namespace policy. Would it be okay to attach it to the document (dojo.doc) instead? This would be hostenv_browser specific, but I suppose the bidi concept generally is?

comment:2 Changed 10 years ago by bill

That sounds good to me; we already much with <body> by setting classes like dj_ieIE, so it's not unprecedented.

However, it also sounds slower since it requires an access to the DOM node on every call.

comment:3 Changed 10 years ago by James Burke

What if you just save off the value in the dojo.withGlobal, set the value to null (so it gets calculated in the new doc) and restore it after the withGlobal finishes? Looks like withDoc might also need to be adjusted. Might need to watch the amount of code it takes, but since this is a low level thing called for lots of positioning/coordinate stuff it may be worth it.

comment:4 Changed 10 years ago by James Burke

Some extra clarification on the motivation for my previous comment:

Operating on other frames is a less frequent operation, so it can be recalculated for every dojo.withGlobal call. Within that withGlobal call it will be cached, but then reset to previous value. I don't feel like we have to go out of our way to support multi doc scenarios since they are fragile and generally we do not try for robust support.

comment:5 Changed 10 years ago by Douglas Hays

Owner: changed from Adam Peller to Douglas Hays
Status: newassigned

comment:6 Changed 10 years ago by Douglas Hays

Resolution: fixed
Status: assignedclosed

(In [16383]) Fixes #8367. Per jburke, unset cached dojo._bodyLtr in withGlobal and withDoc. Had to call delete since _isBodyLtr returns whatever value is set (null/undefined/true/false).

comment:7 Changed 10 years ago by Adam Peller

(In [16385]) save a few bytes. Refs #8367

comment:8 Changed 10 years ago by Adam Peller

(In [16386]) save a few more bytes. Refs #8367

Changed 10 years ago by Adam Peller

Attachment: window-reduction.patch added

forgot to attach this one... needs review

comment:9 Changed 10 years ago by Adam Peller

(In [16541]) dojo._base.window is browser-dependent. Avoid tests in non-browser environments. Refs #8367

Note: See TracTickets for help on using tickets.