Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

offset is now a setter

  • Loading branch information...
commit daffb954e397bd5d9f8e9aaedab6c0baa9609e1e 1 parent f55fb36
Brandon Aaron brandonaaron authored
43 src/offset.js
... ... @@ -1,7 +1,12 @@
1 1 if ( "getBoundingClientRect" in document.documentElement ) {
2   - jQuery.fn.offset = function() {
  2 + jQuery.fn.offset = function( options ) {
3 3 var elem = this[0];
4 4 if ( !elem || !elem.ownerDocument ) { return null; }
  5 + if ( options ) {
  6 + return this.each(function() {
  7 + jQuery.offset.setOffset( this, options );
  8 + });
  9 + }
5 10 if ( elem === elem.ownerDocument.body ) {
6 11 return jQuery.offset.bodyOffset( elem );
7 12 }
@@ -13,9 +18,14 @@ if ( "getBoundingClientRect" in document.documentElement ) {
13 18 return { top: top, left: left };
14 19 };
15 20 } else {
16   - jQuery.fn.offset = function() {
  21 + jQuery.fn.offset = function( options ) {
17 22 var elem = this[0];
18 23 if ( !elem || !elem.ownerDocument ) { return null; }
  24 + if ( options ) {
  25 + return this.each(function() {
  26 + jQuery.offset.setOffset( this, options );
  27 + });
  28 + }
19 29 if ( elem === elem.ownerDocument.body ) {
20 30 return jQuery.offset.bodyOffset( elem );
21 31 }
@@ -25,18 +35,18 @@ if ( "getBoundingClientRect" in document.documentElement ) {
25 35 var offsetParent = elem.offsetParent, prevOffsetParent = elem,
26 36 doc = elem.ownerDocument, computedStyle, docElem = doc.documentElement,
27 37 body = doc.body, defaultView = doc.defaultView,
28   - prevComputedStyle = defaultView.getComputedStyle(elem, null),
  38 + prevComputedStyle = defaultView.getComputedStyle( elem, null ),
29 39 top = elem.offsetTop, left = elem.offsetLeft;
30 40
31 41 while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
32 42 if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) { break; }
33 43
34 44 computedStyle = defaultView.getComputedStyle(elem, null);
35   - top -= elem.scrollTop;
  45 + top -= elem.scrollTop;
36 46 left -= elem.scrollLeft;
37 47
38 48 if ( elem === offsetParent ) {
39   - top += elem.offsetTop;
  49 + top += elem.offsetTop;
40 50 left += elem.offsetLeft;
41 51
42 52 if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.nodeName)) ) {
@@ -100,7 +110,7 @@ jQuery.offset = {
100 110 jQuery.offset.initialize = function(){};
101 111 },
102 112
103   - bodyOffset: function(body) {
  113 + bodyOffset: function( body ) {
104 114 var top = body.offsetTop, left = body.offsetLeft;
105 115
106 116 jQuery.offset.initialize();
@@ -111,6 +121,27 @@ jQuery.offset = {
111 121 }
112 122
113 123 return { top: top, left: left };
  124 + },
  125 +
  126 + setOffset: function( elem, options ) {
  127 + // set position first, in-case top/left are set even on static elem
  128 + if ( /static/.test( jQuery.curCSS( elem, 'position' ) ) ) {
  129 + elem.style.position = 'relative';
  130 + }
  131 + var curElem = jQuery( elem ),
  132 + curOffset = curElem.offset(),
  133 + curTop = parseInt( jQuery.curCSS( elem, 'top', true ), 10 ) || 0,
  134 + curLeft = parseInt( jQuery.curCSS( elem, 'left', true ), 10) || 0,
  135 + props = {
  136 + top: (options.top - curOffset.top) + curTop,
  137 + left: (options.left - curOffset.left) + curLeft
  138 + };
  139 +
  140 + if ( 'using' in options ) {
  141 + options.using.call( elem, props );
  142 + } else {
  143 + curElem.css( props );
  144 + }
114 145 }
115 146 };
116 147
2  test/data/offset/relative.html
@@ -6,7 +6,7 @@
6 6 <title>relative</title>
7 7 <style type="text/css" media="screen">
8 8 body { margin: 1px; padding: 5px; }
9   - div.relative { position: relative; margin: 1px; border: 2px solid #000; padding: 5px; width: 100px; height: 100px; background: #fff; overflow: hidden; }
  9 + div.relative { position: relative; top: 0; left: 0; margin: 1px; border: 2px solid #000; padding: 5px; width: 100px; height: 100px; background: #fff; overflow: hidden; }
10 10 #relative-2 { top: 20px; left: 20px; }
11 11 #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
12 12 </style>
2  test/data/offset/static.html
@@ -6,7 +6,7 @@
6 6 <title>static</title>
7 7 <style type="text/css" media="screen">
8 8 body { margin: 1px; padding: 5px; }
9   - div.static { position: static; margin: 1px; border: 2px solid #000; padding: 5px; width: 100px; height: 100px; background: #fff; overflow: hidden; }
  9 + div.static { position: static; top: 0; left: 0; margin: 1px; border: 2px solid #000; padding: 5px; width: 100px; height: 100px; background: #fff; overflow: hidden; }
10 10 #static-2 { top: 20px; left: 20px; }
11 11 #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
12 12 </style>
284 test/unit/offset.js
... ... @@ -1,107 +1,241 @@
1 1 module("offset");
2 2
3 3 testoffset("absolute", function( jQuery ) {
4   - equals( jQuery('#absolute-1').offset().top, 1, "jQuery('#absolute-1').offset().top" );
5   - equals( jQuery('#absolute-1').offset().left, 1, "jQuery('#absolute-1').offset().left" );
6   -
7   - equals( jQuery('#absolute-1-1').offset().top, 5, "jQuery('#absolute-1-1').offset().top" );
8   - equals( jQuery('#absolute-1-1').offset().left, 5, "jQuery('#absolute-1-1').offset().left" );
9   -
10   - equals( jQuery('#absolute-1-1-1').offset().top, 9, "jQuery('#absolute-1-1-1').offset().top" );
11   - equals( jQuery('#absolute-1-1-1').offset().left, 9, "jQuery('#absolute-1-1-1').offset().left" );
12   -
13   - equals( jQuery('#absolute-2').offset().top, 20, "jQuery('#absolute-2').offset().top" );
14   - equals( jQuery('#absolute-2').offset().left, 20, "jQuery('#absolute-2').offset().left" );
15   -
  4 + // get offset tests
  5 + var tests = [
  6 + { id: '#absolute-1', top: 1, left: 1 },
  7 + { id: '#absolute-1-1', top: 5, left: 5 },
  8 + { id: '#absolute-1-1-1', top: 9, left: 9 },
  9 + { id: '#absolute-2', top: 20, left: 20 }
  10 + ];
  11 + jQuery.each( tests, function() {
  12 + equals( jQuery( this.id ).offset().top, this.top, "jQuery('" + this.id + "').offset().top" );
  13 + equals( jQuery( this.id ).offset().left, this.left, "jQuery('" + this.id + "').offset().left" );
  14 + });
16 15
17   - equals( jQuery('#absolute-1').position().top, 0, "jQuery('#absolute-1').position().top" );
18   - equals( jQuery('#absolute-1').position().left, 0, "jQuery('#absolute-1').position().left" );
19 16
20   - equals( jQuery('#absolute-1-1').position().top, 1, "jQuery('#absolute-1-1').position().top" );
21   - equals( jQuery('#absolute-1-1').position().left, 1, "jQuery('#absolute-1-1').position().left" );
  17 + // get position
  18 + tests = [
  19 + { id: '#absolute-1', top: 0, left: 0 },
  20 + { id: '#absolute-1-1', top: 1, left: 1 },
  21 + { id: '#absolute-1-1-1', top: 1, left: 1 },
  22 + { id: '#absolute-2', top: 19, left: 19 }
  23 + ];
  24 + jQuery.each( tests, function() {
  25 + equals( jQuery( this.id ).position().top, this.top, "jQuery('" + this.id + "').position().top" );
  26 + equals( jQuery( this.id ).position().left, this.left, "jQuery('" + this.id + "').position().left" );
  27 + });
22 28
23   - equals( jQuery('#absolute-1-1-1').position().top, 1, "jQuery('#absolute-1-1-1').position().top" );
24   - equals( jQuery('#absolute-1-1-1').position().left, 1, "jQuery('#absolute-1-1-1').position().left" );
25 29
26   - equals( jQuery('#absolute-2').position().top, 19, "jQuery('#absolute-2').position().top" );
27   - equals( jQuery('#absolute-2').position().left, 19, "jQuery('#absolute-2').position().left" );
  30 + // set offset
  31 + tests = [
  32 + { id: '#absolute-2', top: 30, left: 30 },
  33 + { id: '#absolute-2', top: 10, left: 10 },
  34 + { id: '#absolute-2', top: -1, left: -1 },
  35 + { id: '#absolute-2', top: 19, left: 19 },
  36 + { id: '#absolute-1-1-1', top: 15, left: 15 },
  37 + { id: '#absolute-1-1-1', top: 5, left: 5 },
  38 + { id: '#absolute-1-1-1', top: -1, left: -1 },
  39 + { id: '#absolute-1-1-1', top: 9, left: 9 },
  40 + { id: '#absolute-1-1', top: 10, left: 10 },
  41 + { id: '#absolute-1-1', top: 0, left: 0 },
  42 + { id: '#absolute-1-1', top: -1, left: -1 },
  43 + { id: '#absolute-1-1', top: 5, left: 5 },
  44 + { id: '#absolute-1', top: 2, left: 2 },
  45 + { id: '#absolute-1', top: 0, left: 0 },
  46 + { id: '#absolute-1', top: -1, left: -1 },
  47 + { id: '#absolute-1', top: 1, left: 1 }
  48 + ];
  49 + jQuery.each( tests, function() {
  50 + jQuery( this.id ).offset({ top: this.top, left: this.left });
  51 + equals( jQuery( this.id ).offset().top, this.top, "jQuery('" + this.id + "').offset({ top: " + this.top + " })" );
  52 + equals( jQuery( this.id ).offset().left, this.left, "jQuery('" + this.id + "').offset({ left: " + this.left + " })" );
  53 +
  54 + jQuery( this.id ).offset({ top: this.top, left: this.left, using: function( props ) {
  55 + jQuery( this ).css({
  56 + top: props.top + 1,
  57 + left: props.left + 1
  58 + });
  59 + }});
  60 + equals( jQuery( this.id ).offset().top, this.top + 1, "jQuery('" + this.id + "').offset({ top: " + (this.top + 1) + ", using: fn })" );
  61 + equals( jQuery( this.id ).offset().left, this.left + 1, "jQuery('" + this.id + "').offset({ left: " + (this.left + 1) + ", using: fn })" );
  62 + });
28 63 });
29 64
30 65 testoffset("relative", function( jQuery ) {
31   - var ie = jQuery.browser.msie && parseInt( jQuery.browser.version ) < 8;
32   -
33 66 // IE is collapsing the top margin of 1px
34   - equals( jQuery('#relative-1').offset().top, ie ? 6 : 7, "jQuery('#relative-1').offset().top" );
35   - equals( jQuery('#relative-1').offset().left, 7, "jQuery('#relative-1').offset().left" );
36   -
37   - // IE is collapsing the top margin of 1px
38   - equals( jQuery('#relative-1-1').offset().top, ie ? 13 : 15, "jQuery('#relative-1-1').offset().top" );
39   - equals( jQuery('#relative-1-1').offset().left, 15, "jQuery('#relative-1-1').offset().left" );
  67 + var ie = jQuery.browser.msie && parseInt( jQuery.browser.version ) < 8;
40 68
41   - // IE is collapsing the top margin of 1px
42   - equals( jQuery('#relative-2').offset().top, ie ? 141 : 142, "jQuery('#relative-2').offset().top" );
43   - equals( jQuery('#relative-2').offset().left, 27, "jQuery('#relative-2').offset().left" );
  69 + // get offset
  70 + var tests = [
  71 + { id: '#relative-1', top: ie ? 6 : 7, left: 7 },
  72 + { id: '#relative-1-1', top: ie ? 13 : 15, left: 15 },
  73 + { id: '#relative-2', top: ie ? 141 : 142, left: 27 }
  74 + ];
  75 + jQuery.each( tests, function() {
  76 + equals( jQuery( this.id ).offset().top, this.top, "jQuery('" + this.id + "').offset().top" );
  77 + equals( jQuery( this.id ).offset().left, this.left, "jQuery('" + this.id + "').offset().left" );
  78 + });
44 79
45 80
46   - // IE is collapsing the top margin of 1px
47   - equals( jQuery('#relative-1').position().top, ie ? 5 : 6, "jQuery('#relative-1').position().top" );
48   - equals( jQuery('#relative-1').position().left, 6, "jQuery('#relative-1').position().left" );
  81 + // get position
  82 + tests = [
  83 + { id: '#relative-1', top: ie ? 5 : 6, left: 6 },
  84 + { id: '#relative-1-1', top: ie ? 4 : 5, left: 5 },
  85 + { id: '#relative-2', top: ie ? 140 : 141, left: 26 }
  86 + ];
  87 + jQuery.each( tests, function() {
  88 + equals( jQuery( this.id ).position().top, this.top, "jQuery('" + this.id + "').position().top" );
  89 + equals( jQuery( this.id ).position().left, this.left, "jQuery('" + this.id + "').position().left" );
  90 + });
49 91
50   - // IE is collapsing the top margin of 1px
51   - equals( jQuery('#relative-1-1').position().top, ie ? 4 : 5, "jQuery('#relative-1-1').position().top" );
52   - equals( jQuery('#relative-1-1').position().left, 5, "jQuery('#relative-1-1').position().left" );
53 92
54   - // IE is collapsing the top margin of 1px
55   - equals( jQuery('#relative-2').position().top, ie ? 140 : 141, "jQuery('#relative-2').position().top" );
56   - equals( jQuery('#relative-2').position().left, 26, "jQuery('#relative-2').position().left" );
  93 + // set offset
  94 + tests = [
  95 + { id: '#relative-2', top: 200, left: 50 },
  96 + { id: '#relative-2', top: 100, left: 10 },
  97 + { id: '#relative-2', top: -5, left: -5 },
  98 + { id: '#relative-2', top: 142, left: 27 },
  99 + { id: '#relative-1-1', top: 100, left: 100 },
  100 + { id: '#relative-1-1', top: 5, left: 5 },
  101 + { id: '#relative-1-1', top: -1, left: -1 },
  102 + { id: '#relative-1-1', top: 15, left: 15 },
  103 + { id: '#relative-1', top: 100, left: 100 },
  104 + { id: '#relative-1', top: 0, left: 0 },
  105 + { id: '#relative-1', top: -1, left: -1 },
  106 + { id: '#relative-1', top: 7, left: 7 }
  107 + ];
  108 + jQuery.each( tests, function() {
  109 + jQuery( this.id ).offset({ top: this.top, left: this.left });
  110 + equals( jQuery( this.id ).offset().top, this.top, "jQuery('" + this.id + "').offset({ top: " + this.top + " })" );
  111 + equals( jQuery( this.id ).offset().left, this.left, "jQuery('" + this.id + "').offset({ left: " + this.left + " })" );
  112 +
  113 + jQuery( this.id ).offset({ top: this.top, left: this.left, using: function( props ) {
  114 + jQuery( this ).css({
  115 + top: props.top + 1,
  116 + left: props.left + 1
  117 + });
  118 + }});
  119 + equals( jQuery( this.id ).offset().top, this.top + 1, "jQuery('" + this.id + "').offset({ top: " + (this.top + 1) + ", using: fn })" );
  120 + equals( jQuery( this.id ).offset().left, this.left + 1, "jQuery('" + this.id + "').offset({ left: " + (this.left + 1) + ", using: fn })" );
  121 + });
57 122 });
58 123
59 124 testoffset("static", function( jQuery ) {
60   - var ie = jQuery.browser.msie && parseInt( jQuery.browser.version ) < 8;
61   -
62   - // IE is collapsing the top margin of 1px
63   - equals( jQuery('#static-1').offset().top, ie ? 6 : 7, "jQuery('#static-1').offset().top" );
64   - equals( jQuery('#static-1').offset().left, 7, "jQuery('#static-1').offset().left" );
65   -
66   - // IE is collapsing the top margin of 1px
67   - equals( jQuery('#static-1-1').offset().top, ie ? 13 : 15, "jQuery('#static-1-1').offset().top" );
68   - equals( jQuery('#static-1-1').offset().left, 15, "jQuery('#static-1-1').offset().left" );
69   -
70 125 // IE is collapsing the top margin of 1px
71   - equals( jQuery('#static-1-1-1').offset().top, ie ? 20 : 23, "jQuery('#static-1-1-1').offset().top" );
72   - equals( jQuery('#static-1-1-1').offset().left, 23, "jQuery('#static-1-1-1').offset().left" );
73   -
74   - // IE is collapsing the top margin of 1px
75   - equals( jQuery('#static-2').offset().top, ie ? 121 : 122, "jQuery('#static-2').offset().top" );
76   - equals( jQuery('#static-2').offset().left, 7, "jQuery('#static-2').offset().left" );
  126 + var ie = jQuery.browser.msie && parseInt( jQuery.browser.version ) < 8;
77 127
  128 + // get offset
  129 + var tests = [
  130 + { id: '#static-1', top: ie ? 6 : 7, left: 7 },
  131 + { id: '#static-1-1', top: ie ? 13 : 15, left: 15 },
  132 + { id: '#static-1-1-1', top: ie ? 20 : 23, left: 23 },
  133 + { id: '#static-2', top: ie ? 121 : 122, left: 7 }
  134 + ];
  135 + jQuery.each( tests, function() {
  136 + equals( jQuery( this.id ).offset().top, this.top, "jQuery('" + this.id + "').offset().top" );
  137 + equals( jQuery( this.id ).offset().left, this.left, "jQuery('" + this.id + "').offset().left" );
  138 + });
78 139
79   - // IE is collapsing the top margin of 1px
80   - equals( jQuery('#static-1').position().top, ie ? 5 : 6, "jQuery('#static-1').position().top" );
81   - equals( jQuery('#static-1').position().left, 6, "jQuery('#static-1').position().left" );
82 140
83   - // IE is collapsing the top margin of 1px
84   - equals( jQuery('#static-1-1').position().top, ie ? 12 : 14, "jQuery('#static-1-1').position().top" );
85   - equals( jQuery('#static-1-1').position().left, 14, "jQuery('#static-1-1').position().left" );
  141 + // get position
  142 + tests = [
  143 + { id: '#static-1', top: ie ? 5 : 6, left: 6 },
  144 + { id: '#static-1-1', top: ie ? 12 : 14, left: 14 },
  145 + { id: '#static-1-1-1', top: ie ? 19 : 22, left: 22 },
  146 + { id: '#static-2', top: ie ? 120 : 121, left: 6 }
  147 + ];
  148 + jQuery.each( tests, function() {
  149 + equals( jQuery( this.id ).position().top, this.top, "jQuery('" + this.top + "').position().top" );
  150 + equals( jQuery( this.id ).position().left, this.left, "jQuery('" + this.left +"').position().left" );
  151 + });
86 152
87   - // IE is collapsing the top margin of 1px
88   - equals( jQuery('#static-1-1-1').position().top, ie ? 19 : 22, "jQuery('#static-1-1-1').position().top" );
89   - equals( jQuery('#static-1-1-1').position().left, 22, "jQuery('#static-1-1-1').position().left" );
90 153
91   - // IE is collapsing the top margin of 1px
92   - equals( jQuery('#static-2').position().top, ie ? 120 : 121, "jQuery('#static-2').position().top" );
93   - equals( jQuery('#static-2').position().left, 6, "jQuery('#static-2').position().left" );
  154 + // set offset
  155 + tests = [
  156 + { id: '#static-2', top: 200, left: 200 },
  157 + { id: '#static-2', top: 100, left: 100 },
  158 + { id: '#static-2', top: -2, left: -2 },
  159 + { id: '#static-2', top: 121, left: 6 },
  160 + { id: '#static-1-1-1', top: 50, left: 50 },
  161 + { id: '#static-1-1-1', top: 10, left: 10 },
  162 + { id: '#static-1-1-1', top: -1, left: -1 },
  163 + { id: '#static-1-1-1', top: 22, left: 22 },
  164 + { id: '#static-1-1', top: 25, left: 25 },
  165 + { id: '#static-1-1', top: 10, left: 10 },
  166 + { id: '#static-1-1', top: -3, left: -3 },
  167 + { id: '#static-1-1', top: 14, left: 14 },
  168 + { id: '#static-1', top: 30, left: 30 },
  169 + { id: '#static-1', top: 2, left: 2 },
  170 + { id: '#static-1', top: -2, left: -2 },
  171 + { id: '#static-1', top: 7, left: 7 }
  172 + ];
  173 + jQuery.each( tests, function() {
  174 + jQuery( this.id ).offset({ top: this.top, left: this.left });
  175 + equals( jQuery( this.id ).offset().top, this.top, "jQuery('" + this.id + "').offset({ top: " + this.top + " })" );
  176 + equals( jQuery( this.id ).offset().left, this.left, "jQuery('" + this.id + "').offset({ left: " + this.left + " })" );
  177 +
  178 + jQuery( this.id ).offset({ top: this.top, left: this.left, using: function( props ) {
  179 + jQuery( this ).css({
  180 + top: props.top + 1,
  181 + left: props.left + 1
  182 + });
  183 + }});
  184 + equals( jQuery( this.id ).offset().top, this.top + 1, "jQuery('" + this.id + "').offset({ top: " + (this.top + 1) + ", using: fn })" );
  185 + equals( jQuery( this.id ).offset().left, this.left + 1, "jQuery('" + this.id + "').offset({ left: " + (this.left + 1) + ", using: fn })" );
  186 + });
94 187 });
95 188
96   -if ( jQuery.offset.supportsFixedPosition ) {
97   - testoffset("fixed", function( jQuery ) {
98   - equals( jQuery('#fixed-1').offset().top, 1001, "jQuery('#fixed-1').offset().top" );
99   - equals( jQuery('#fixed-1').offset().left, 1001, "jQuery('#fixed-1').offset().left" );
  189 +testoffset("fixed", function( jQuery ) {
  190 + jQuery.offset.initialize();
  191 +
  192 + var tests = [
  193 + { id: '#fixed-1', top: 1001, left: 1001 },
  194 + { id: '#fixed-2', top: 1021, left: 1021 }
  195 + ];
  196 + jQuery.each( tests, function() {
  197 + if ( jQuery.offset.supportsFixedPosition ) {
  198 + equals( jQuery( this.id ).offset().top, this.top, "jQuery('" + this.id + "').offset().top" );
  199 + equals( jQuery( this.id ).offset().left, this.left, "jQuery('" + this.id + "').offset().left" );
  200 + } else {
  201 + // need to have same number of assertions
  202 + ok( true, 'Fixed position is not supported' );
  203 + ok( true, 'Fixed position is not supported' );
  204 + }
  205 + });
100 206
101   - equals( jQuery('#fixed-2').offset().top, 1021, "jQuery('#fixed-2').offset().top" );
102   - equals( jQuery('#fixed-2').offset().left, 1021, "jQuery('#fixed-2').offset().left" );
  207 + tests = [
  208 + { id: '#fixed-1', top: 100, left: 100 },
  209 + { id: '#fixed-1', top: 0, left: 0 },
  210 + { id: '#fixed-1', top: -4, left: -4 },
  211 + { id: '#fixed-2', top: 200, left: 200 },
  212 + { id: '#fixed-2', top: 0, left: 0 },
  213 + { id: '#fixed-2', top: -5, left: -5 }
  214 + ];
  215 +
  216 + jQuery.each( tests, function() {
  217 + if ( jQuery.offset.supportsFixedPosition ) {
  218 + jQuery( this.id ).offset({ top: this.top, left: this.left });
  219 + equals( jQuery( this.id ).offset().top, this.top, "jQuery('" + this.id + "').offset({ top: " + this.top + " })" );
  220 + equals( jQuery( this.id ).offset().left, this.left, "jQuery('" + this.id + "').offset({ left: " + this.left + " })" );
  221 +
  222 + jQuery( this.id ).offset({ top: this.top, left: this.left, using: function( props ) {
  223 + jQuery( this ).css({
  224 + top: props.top + 1,
  225 + left: props.left + 1
  226 + });
  227 + }});
  228 + equals( jQuery( this.id ).offset().top, this.top + 1, "jQuery('" + this.id + "').offset({ top: " + (this.top + 1) + ", using: fn })" );
  229 + equals( jQuery( this.id ).offset().left, this.left + 1, "jQuery('" + this.id + "').offset({ left: " + (this.left + 1) + ", using: fn })" );
  230 + } else {
  231 + // need to have same number of assertions
  232 + ok( true, 'Fixed position is not supported' );
  233 + ok( true, 'Fixed position is not supported' );
  234 + ok( true, 'Fixed position is not supported' );
  235 + ok( true, 'Fixed position is not supported' );
  236 + }
103 237 });
104   -}
  238 +});
105 239
106 240 testoffset("table", function( jQuery ) {
107 241 var ie = jQuery.browser.msie;

0 comments on commit daffb95

Please sign in to comment.
Something went wrong with that request. Please try again.