Skip to content

Commit e78aec6

Browse files
committed
Drag: Always use the target's owner document
Fixes jquerygh-31
1 parent 2d24d9a commit e78aec6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

jquery.simulate.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ $.extend( $.simulate.prototype, {
295295
simulateDrag: function() {
296296
var i = 0,
297297
target = this.target,
298+
eventDoc = target.ownerDocument,
298299
options = this.options,
299300
center = options.handle === "corner" ? findCorner( target ) : findCenter( target ),
300301
x = Math.floor( center.x ),
@@ -315,14 +316,14 @@ $.extend( $.simulate.prototype, {
315316
clientY: Math.round( y )
316317
};
317318

318-
this.simulateEvent( target.ownerDocument, "mousemove", coord );
319+
this.simulateEvent( eventDoc, "mousemove", coord );
319320
}
320321

321-
if ( $.contains( document, target ) ) {
322+
if ( $.contains( eventDoc, target ) ) {
322323
this.simulateEvent( target, "mouseup", coord );
323324
this.simulateEvent( target, "click", coord );
324325
} else {
325-
this.simulateEvent( document, "mouseup", coord );
326+
this.simulateEvent( eventDoc, "mouseup", coord );
326327
}
327328
}
328329
});

0 commit comments

Comments
 (0)