@@ -276,7 +276,7 @@ return $.widget("ui.sortable", $.ui.mouse, {
276
276
}
277
277
278
278
//Prepare scrolling
279
- if ( this . scrollParent [ 0 ] !== document && this . scrollParent [ 0 ] . tagName !== "HTML" ) {
279
+ if ( this . scrollParent [ 0 ] !== this . document [ 0 ] && this . scrollParent [ 0 ] . tagName !== "HTML" ) {
280
280
this . overflowOffset = this . scrollParent . offset ( ) ;
281
281
}
282
282
@@ -328,7 +328,7 @@ return $.widget("ui.sortable", $.ui.mouse, {
328
328
329
329
//Do scrolling
330
330
if ( this . options . scroll ) {
331
- if ( this . scrollParent [ 0 ] !== document && this . scrollParent [ 0 ] . tagName !== "HTML" ) {
331
+ if ( this . scrollParent [ 0 ] !== this . document [ 0 ] && this . scrollParent [ 0 ] . tagName !== "HTML" ) {
332
332
333
333
if ( ( this . overflowOffset . top + this . scrollParent [ 0 ] . offsetHeight ) - event . pageY < o . scrollSensitivity ) {
334
334
this . scrollParent [ 0 ] . scrollTop = scrolled = this . scrollParent [ 0 ] . scrollTop + o . scrollSpeed ;
@@ -344,16 +344,16 @@ return $.widget("ui.sortable", $.ui.mouse, {
344
344
345
345
} else {
346
346
347
- if ( event . pageY - $ ( document ) . scrollTop ( ) < o . scrollSensitivity ) {
348
- scrolled = $ ( document ) . scrollTop ( $ ( document ) . scrollTop ( ) - o . scrollSpeed ) ;
349
- } else if ( $ ( window ) . height ( ) - ( event . pageY - $ ( document ) . scrollTop ( ) ) < o . scrollSensitivity ) {
350
- scrolled = $ ( document ) . scrollTop ( $ ( document ) . scrollTop ( ) + o . scrollSpeed ) ;
347
+ if ( event . pageY - this . document . scrollTop ( ) < o . scrollSensitivity ) {
348
+ scrolled = this . document . scrollTop ( this . document . scrollTop ( ) - o . scrollSpeed ) ;
349
+ } else if ( this . window . height ( ) - ( event . pageY - this . document . scrollTop ( ) ) < o . scrollSensitivity ) {
350
+ scrolled = this . document . scrollTop ( this . document . scrollTop ( ) + o . scrollSpeed ) ;
351
351
}
352
352
353
- if ( event . pageX - $ ( document ) . scrollLeft ( ) < o . scrollSensitivity ) {
354
- scrolled = $ ( document ) . scrollLeft ( $ ( document ) . scrollLeft ( ) - o . scrollSpeed ) ;
355
- } else if ( $ ( window ) . width ( ) - ( event . pageX - $ ( document ) . scrollLeft ( ) ) < o . scrollSensitivity ) {
356
- scrolled = $ ( document ) . scrollLeft ( $ ( document ) . scrollLeft ( ) + o . scrollSpeed ) ;
353
+ if ( event . pageX - this . document . scrollLeft ( ) < o . scrollSensitivity ) {
354
+ scrolled = this . document . scrollLeft ( this . document . scrollLeft ( ) - o . scrollSpeed ) ;
355
+ } else if ( this . window . width ( ) - ( event . pageX - this . document . scrollLeft ( ) ) < o . scrollSensitivity ) {
356
+ scrolled = this . document . scrollLeft ( this . document . scrollLeft ( ) + o . scrollSpeed ) ;
357
357
}
358
358
359
359
}
@@ -452,10 +452,10 @@ return $.widget("ui.sortable", $.ui.mouse, {
452
452
animation = { } ;
453
453
454
454
if ( ! axis || axis === "x" ) {
455
- animation . left = cur . left - this . offset . parent . left - this . margins . left + ( this . offsetParent [ 0 ] === document . body ? 0 : this . offsetParent [ 0 ] . scrollLeft ) ;
455
+ animation . left = cur . left - this . offset . parent . left - this . margins . left + ( this . offsetParent [ 0 ] === this . document [ 0 ] . body ? 0 : this . offsetParent [ 0 ] . scrollLeft ) ;
456
456
}
457
457
if ( ! axis || axis === "y" ) {
458
- animation . top = cur . top - this . offset . parent . top - this . margins . top + ( this . offsetParent [ 0 ] === document . body ? 0 : this . offsetParent [ 0 ] . scrollTop ) ;
458
+ animation . top = cur . top - this . offset . parent . top - this . margins . top + ( this . offsetParent [ 0 ] === this . document [ 0 ] . body ? 0 : this . offsetParent [ 0 ] . scrollTop ) ;
459
459
}
460
460
this . reverting = true ;
461
461
$ ( this . helper ) . animate ( animation , parseInt ( this . options . revert , 10 ) || 500 , function ( ) {
@@ -648,7 +648,7 @@ return $.widget("ui.sortable", $.ui.mouse, {
648
648
649
649
if ( connectWith && connected ) {
650
650
for ( i = connectWith . length - 1 ; i >= 0 ; i -- ) {
651
- cur = $ ( connectWith [ i ] ) ;
651
+ cur = $ ( connectWith [ i ] , this . document [ 0 ] ) ;
652
652
for ( j = cur . length - 1 ; j >= 0 ; j -- ) {
653
653
inst = $ . data ( cur [ j ] , this . widgetFullName ) ;
654
654
if ( inst && inst !== this && ! inst . options . disabled ) {
@@ -698,7 +698,7 @@ return $.widget("ui.sortable", $.ui.mouse, {
698
698
699
699
if ( connectWith && this . ready ) { //Shouldn't be run the first time through due to massive slow-down
700
700
for ( i = connectWith . length - 1 ; i >= 0 ; i -- ) {
701
- cur = $ ( connectWith [ i ] ) ;
701
+ cur = $ ( connectWith [ i ] , this . document [ 0 ] ) ;
702
702
for ( j = cur . length - 1 ; j >= 0 ; j -- ) {
703
703
inst = $ . data ( cur [ j ] , this . widgetFullName ) ;
704
704
if ( inst && inst !== this && ! inst . options . disabled ) {
@@ -990,14 +990,14 @@ return $.widget("ui.sortable", $.ui.mouse, {
990
990
// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
991
991
// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
992
992
// the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
993
- if ( this . cssPosition === "absolute" && this . scrollParent [ 0 ] !== document && $ . contains ( this . scrollParent [ 0 ] , this . offsetParent [ 0 ] ) ) {
993
+ if ( this . cssPosition === "absolute" && this . scrollParent [ 0 ] !== this . document [ 0 ] && $ . contains ( this . scrollParent [ 0 ] , this . offsetParent [ 0 ] ) ) {
994
994
po . left += this . scrollParent . scrollLeft ( ) ;
995
995
po . top += this . scrollParent . scrollTop ( ) ;
996
996
}
997
997
998
998
// This needs to be actually done for all browsers, since pageX/pageY includes this information
999
999
// with an ugly IE fix
1000
- if ( this . offsetParent [ 0 ] === document . body || ( this . offsetParent [ 0 ] . tagName && this . offsetParent [ 0 ] . tagName . toLowerCase ( ) === "html" && $ . ui . ie ) ) {
1000
+ if ( this . offsetParent [ 0 ] === this . document [ 0 ] . body || ( this . offsetParent [ 0 ] . tagName && this . offsetParent [ 0 ] . tagName . toLowerCase ( ) === "html" && $ . ui . ie ) ) {
1001
1001
po = { top : 0 , left : 0 } ;
1002
1002
}
1003
1003
@@ -1047,8 +1047,8 @@ return $.widget("ui.sortable", $.ui.mouse, {
1047
1047
this . containment = [
1048
1048
0 - this . offset . relative . left - this . offset . parent . left ,
1049
1049
0 - this . offset . relative . top - this . offset . parent . top ,
1050
- $ ( o . containment === "document" ? document : window ) . width ( ) - this . helperProportions . width - this . margins . left ,
1051
- ( $ ( o . containment === "document" ? document : window ) . height ( ) || document . body . parentNode . scrollHeight ) - this . helperProportions . height - this . margins . top
1050
+ o . containment === "document" ? this . document . width ( ) : this . window . width ( ) - this . helperProportions . width - this . margins . left ,
1051
+ ( o . containment === "document" ? this . document . width ( ) : this . window . height ( ) || this . document [ 0 ] . body . parentNode . scrollHeight ) - this . helperProportions . height - this . margins . top
1052
1052
] ;
1053
1053
}
1054
1054
@@ -1073,7 +1073,7 @@ return $.widget("ui.sortable", $.ui.mouse, {
1073
1073
pos = this . position ;
1074
1074
}
1075
1075
var mod = d === "absolute" ? 1 : - 1 ,
1076
- scroll = this . cssPosition === "absolute" && ! ( this . scrollParent [ 0 ] !== document && $ . contains ( this . scrollParent [ 0 ] , this . offsetParent [ 0 ] ) ) ? this . offsetParent : this . scrollParent ,
1076
+ scroll = this . cssPosition === "absolute" && ! ( this . scrollParent [ 0 ] !== this . document [ 0 ] && $ . contains ( this . scrollParent [ 0 ] , this . offsetParent [ 0 ] ) ) ? this . offsetParent : this . scrollParent ,
1077
1077
scrollIsRootNode = ( / ( h t m l | b o d y ) / i) . test ( scroll [ 0 ] . tagName ) ;
1078
1078
1079
1079
return {
@@ -1099,13 +1099,13 @@ return $.widget("ui.sortable", $.ui.mouse, {
1099
1099
o = this . options ,
1100
1100
pageX = event . pageX ,
1101
1101
pageY = event . pageY ,
1102
- scroll = this . cssPosition === "absolute" && ! ( this . scrollParent [ 0 ] !== document && $ . contains ( this . scrollParent [ 0 ] , this . offsetParent [ 0 ] ) ) ? this . offsetParent : this . scrollParent , scrollIsRootNode = ( / ( h t m l | b o d y ) / i) . test ( scroll [ 0 ] . tagName ) ;
1102
+ scroll = this . cssPosition === "absolute" && ! ( this . scrollParent [ 0 ] !== this . document [ 0 ] && $ . contains ( this . scrollParent [ 0 ] , this . offsetParent [ 0 ] ) ) ? this . offsetParent : this . scrollParent , scrollIsRootNode = ( / ( h t m l | b o d y ) / i) . test ( scroll [ 0 ] . tagName ) ;
1103
1103
1104
1104
// This is another very weird special case that only happens for relative elements:
1105
1105
// 1. If the css position is relative
1106
1106
// 2. and the scroll parent is the document or similar to the offset parent
1107
1107
// we have to refresh the relative offset during the scroll so there are no jumps
1108
- if ( this . cssPosition === "relative" && ! ( this . scrollParent [ 0 ] !== document && this . scrollParent [ 0 ] !== this . offsetParent [ 0 ] ) ) {
1108
+ if ( this . cssPosition === "relative" && ! ( this . scrollParent [ 0 ] !== this . document [ 0 ] && this . scrollParent [ 0 ] !== this . offsetParent [ 0 ] ) ) {
1109
1109
this . offset . relative = this . _getRelativeOffset ( ) ;
1110
1110
}
1111
1111
0 commit comments