Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#10020 closed defect (fixed)

[patch][ccla]IE: dojo.position failing with dojo.withGlobal

Reported by: Douglas Hays Owned by: Douglas Hays
Priority: high Milestone: 1.4
Component: Core Version: 1.3.2
Keywords: Cc:
Blocked By: Blocking:

Description

When you run dojo.position with a different window context via withGlobal, you often get incorrect x/y values which is causing several rendering problems.
There are 2 separate problems:
1) dojo.isQuirks is used by dojo.position, but this is not reset when withDoc is called, causng position() to use the wrong computations.
2) if isQuirks is true, position() subtracts clientLeft/Top but offsetLeft/Top should also be subtracted since these values can be nonzero when padding is applied to HTML elements.
Technically, position() could recompute its own isQuirks variable if we don't want to fix withDoc. I'd like to get this fixed for 1.4 since its breaking dijit.scrollIntoView.

Attachments (6)

absBug.html (1.2 KB) - added by Douglas Hays 10 years ago.
main test file showing incorrect position values
absBugIframe.html (396 bytes) - added by Douglas Hays 10 years ago.
iframe source file loaded by main test file
10020.patch (2.4 KB) - added by Douglas Hays 10 years ago.
patch file for position() and withDoc()
10020.2.patch (9.0 KB) - added by Douglas Hays 10 years ago.
updated patch with DOH tests and additional fixes
absQuirksIframe.html (442 bytes) - added by Douglas Hays 10 years ago.
test file needed by new html.html
absStrictIframe.html (488 bytes) - added by Douglas Hays 10 years ago.
test file needed by new html.html

Download all attachments as: .zip

Change History (14)

Changed 10 years ago by Douglas Hays

Attachment: absBug.html added

main test file showing incorrect position values

Changed 10 years ago by Douglas Hays

Attachment: absBugIframe.html added

iframe source file loaded by main test file

Changed 10 years ago by Douglas Hays

Attachment: 10020.patch added

patch file for position() and withDoc()

comment:1 Changed 10 years ago by Douglas Hays

Summary: IE: dojo.position failing with dojo.withGlobal[patch][ccla]IE: dojo.position failing with dojo.withGlobal

comment:2 Changed 10 years ago by James Burke

Milestone: tbd1.4
Owner: changed from James Burke to Douglas Hays

Patch looks fine, if it is possible to integrate the test file with the DOH tests, that is great, otherwise check it in so we have it laying around to test manually.

Feel free to commit it.

Changed 10 years ago by Douglas Hays

Attachment: 10020.2.patch added

updated patch with DOH tests and additional fixes

comment:3 Changed 10 years ago by Douglas Hays

Fixed additional problems:
1) withDoc did not delete dojo._isBodyLtr in finally which could cause the withDoc value to stick around.
2) _getIeDocumentElementOffset failed when working with iframes. The iframe border made the offsets go negative for IE6/7. For IE6, testing window was bad and should have been dojo.global. But after that was fixed, then the calculation for RTL/IE6 was messed up since html.clientWidth can be 0 causing the returned offset to be hugely negative.
3) After fixing these problems, then a workaround in scrollIntoView when using IE/RTL needed to be removed since it was no longer needed.
Added iframe test to html.html.

Changed 10 years ago by Douglas Hays

Attachment: absQuirksIframe.html added

test file needed by new html.html

Changed 10 years ago by Douglas Hays

Attachment: absStrictIframe.html added

test file needed by new html.html

comment:4 Changed 10 years ago by James Burke

Visual inspection of the new patch looks good to me, feel free to apply it.

comment:5 Changed 10 years ago by Douglas Hays

Resolution: fixed
Status: newclosed

(In [20428]) Fixes #10020. References #9859. Fixed several problems related to dojo.position()'s use inside iframes. Fixed several IE-specific problems related to inaccurate position() attributes caused by iframe style. Fixed withDoc to restore _isBodyLtr and to properly set/restore isQuirks. Changed isQuirks definition to only check for "BackCompat?" since other values are for ancient unsupported browsers. Added automated iframe tests to html.html. Removed workaround from dijit's scroll.js that's no longer needed after these fixes. Verified all html.html and test_scroll.html tests pass on all supported browsers. !strict

comment:6 Changed 10 years ago by bill

Resolution: fixed
Status: closedreopened

Since [20428] the html_rtl.html is failing on IE6 (and maybe other browsers too). Actually, it works standalone, but fails when run as part of suite (from runTests.html).

comment:7 Changed 10 years ago by Douglas Hays

Resolution: fixed
Status: reopenedclosed

The testcase is failing due to timing (unhides an element and then immediately checks the position before the browser has had time to render). This will be fixed under a separate ticket #10147 since its unrelated to this ticket. This changeset just tweaked the timing enough such that the problem happens frequently now.

comment:8 Changed 10 years ago by bill

Ok, thanks! (For the record, the new ticket is #10147.)

Note: See TracTickets for help on using tickets.