Skip to content

Commit

Permalink
Detect IE collapsing body margin directly rather than inferring it.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmethvin committed Jun 18, 2012
1 parent 5c37506 commit c18f1f1
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions test/unit/offset.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ testIframe("offset/absolute", "absolute", function( jQuery ) {
testIframe("offset/relative", "relative", function( jQuery ) {
expect(60);

// IE is collapsing the top margin of 1px
var ie = document.documentMode && document.documentMode < 8;
// IE is collapsing the top margin of 1px; detect and adjust accordingly
var ie = jQuery("#relative-1").offset().top === 6;

// get offset
var tests = [
Expand Down Expand Up @@ -205,8 +205,8 @@ testIframe("offset/relative", "relative", function( jQuery ) {
testIframe("offset/static", "static", function( jQuery ) {
expect(80);

// IE is collapsing the top margin of 1px
var ie = document.documentMode && document.documentMode < 8;
// IE is collapsing the top margin of 1px; detect and adjust accordingly
var ie = jQuery("#static-1").offset().top === 6;

// get offset
var tests = [
Expand Down Expand Up @@ -349,13 +349,12 @@ testIframe("offset/table", "table", function( jQuery ) {
testIframe("offset/scroll", "scroll", function( jQuery, win ) {
expect(26);

var ie = document.documentMode && document.documentMode < 8;
// IE is collapsing the top margin of 1px; detect and adjust accordingly
var ie = jQuery("#scroll-1").offset().top == 6;

This comment has been minimized.

Copy link
@mikesherov

mikesherov Jun 18, 2012

Member

Is this what it's come to!?

This comment has been minimized.

Copy link
@dmethvin

dmethvin Jun 18, 2012

Author Member

Seems that way. :trollface: And it still didn't fix the IE8 fails. :(

This comment has been minimized.

Copy link
@mikesherov

mikesherov Jun 19, 2012

Member

I'll get a repro and fix tonight.


// IE is collapsing the top margin of 1px
equal( jQuery("#scroll-1").offset().top, ie ? 6 : 7, "jQuery('#scroll-1').offset().top" );
equal( jQuery("#scroll-1").offset().left, 7, "jQuery('#scroll-1').offset().left" );

// IE is collapsing the top margin of 1px
equal( jQuery("#scroll-1-1").offset().top, ie ? 9 : 11, "jQuery('#scroll-1-1').offset().top" );
equal( jQuery("#scroll-1-1").offset().left, 11, "jQuery('#scroll-1-1').offset().left" );

Expand Down

0 comments on commit c18f1f1

Please sign in to comment.