+ tests = [
+ { id: '#fixed-1', top: 100, left: 100 },
+ { id: '#fixed-1', top: 0, left: 0 },
+ { id: '#fixed-1', top: -4, left: -4 },
+ { id: '#fixed-2', top: 200, left: 200 },
+ { id: '#fixed-2', top: 0, left: 0 },
+ { id: '#fixed-2', top: -5, left: -5 }
+ ];
+
+ jQuery.each( tests, function() {
+ if ( jQuery.offset.supportsFixedPosition ) {
+ jQuery( this.id ).offset({ top: this.top, left: this.left });
+ equals( jQuery( this.id ).offset().top, this.top, "jQuery('" + this.id + "').offset({ top: " + this.top + " })" );
+ equals( jQuery( this.id ).offset().left, this.left, "jQuery('" + this.id + "').offset({ left: " + this.left + " })" );
+
+ jQuery( this.id ).offset({ top: this.top, left: this.left, using: function( props ) {
+ jQuery( this ).css({
+ top: props.top + 1,
+ left: props.left + 1
+ });
+ }});
+ equals( jQuery( this.id ).offset().top, this.top + 1, "jQuery('" + this.id + "').offset({ top: " + (this.top + 1) + ", using: fn })" );
+ equals( jQuery( this.id ).offset().left, this.left + 1, "jQuery('" + this.id + "').offset({ left: " + (this.left + 1) + ", using: fn })" );
+ } else {
+ // need to have same number of assertions
+ ok( true, 'Fixed position is not supported' );
+ ok( true, 'Fixed position is not supported' );
+ ok( true, 'Fixed position is not supported' );
+ ok( true, 'Fixed position is not supported' );
+ }
+ });
+});
+
+testoffset("table", function( jQuery ) {
+ var ie = jQuery.browser.msie;
+
+ equals( jQuery('#table-1').offset().top, 6, "jQuery('#table-1').offset().top" );
+ equals( jQuery('#table-1').offset().left, 6, "jQuery('#table-1').offset().left" );
+
+ equals( jQuery('#th-1').offset().top, 10, "jQuery('#th-1').offset().top" );
+ equals( jQuery('#th-1').offset().left, 10, "jQuery('#th-1').offset().left" );
+
+ // equals( jQuery('#th-2').offset().top, 10, "jQuery('#th-2').offset().top" );
+ // equals( jQuery('#th-2').offset().left, 116, "jQuery('#th-2').offset().left" );
+ //
+ // equals( jQuery('#th-3').offset().top, 10, "jQuery('#th-3').offset().top" );
+ // equals( jQuery('#th-3').offset().left, 222, "jQuery('#th-3').offset().left" );
+
+ // equals( jQuery('#td-1').offset().top, ie ? 116 : 112, "jQuery('#td-1').offset().top" );
+ // equals( jQuery('#td-1').offset().left, 10, "jQuery('#td-1').offset().left" );
+ //
+ // equals( jQuery('#td-2').offset().top, ie ? 116 : 112, "jQuery('#td-2').offset().top" );
+ // equals( jQuery('#td-2').offset().left, 116, "jQuery('#td-2').offset().left" );
+ //
+ // equals( jQuery('#td-3').offset().top, ie ? 116 : 112, "jQuery('#td-3').offset().top" );
+ // equals( jQuery('#td-3').offset().left, 222, "jQuery('#td-3').offset().left" );
+});
+
+testoffset("scroll", function( jQuery, win ) {
+ var ie = jQuery.browser.msie && parseInt( jQuery.browser.version ) < 8;