aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.draggable.js
diff options
context:
space:
mode:
authorMike Sherov <mike.sherov@gmail.com>2013-04-02 09:08:17 -0400
committerMike Sherov <mike.sherov@gmail.com>2013-04-02 19:51:36 -0400
commita88d64514001867b908776e6bfcfac7f1011970d (patch)
treee7dfd7a6afab4514fc9f9ee0b07a06a746a08c67 /ui/jquery.ui.draggable.js
parent09b3533910e887377fc87126608db1ded06f38f6 (diff)
downloadjquery-ui-a88d64514001867b908776e6bfcfac7f1011970d.tar.gz
jquery-ui-a88d64514001867b908776e6bfcfac7f1011970d.zip
Draggable: Stop erroneously overriding scroll offsets for root nodes. Fixes #6258 - Draggable: not following mouse when scrolled and using overflow-y: scroll.
Diffstat (limited to 'ui/jquery.ui.draggable.js')
-rw-r--r--ui/jquery.ui.draggable.js13
1 files changed, 6 insertions, 7 deletions
diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js
index 0c58aa4b8..4814cb851 100644
--- a/ui/jquery.ui.draggable.js
+++ b/ui/jquery.ui.draggable.js
@@ -440,7 +440,7 @@ $.widget("ui.draggable", $.ui.mouse, {
}
var mod = d === "absolute" ? 1 : -1,
- scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
+ scroll = this.cssPosition === "absolute" && !( this.scrollParent[ 0 ] !== document && $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? this.offsetParent : this.scrollParent;
//Cache the scroll
if (!this.offset.scroll) {
@@ -452,13 +452,13 @@ $.widget("ui.draggable", $.ui.mouse, {
pos.top + // The absolute mouse position
this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border)
- ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod)
+ ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : this.offset.scroll.top ) * mod )
),
left: (
pos.left + // The absolute mouse position
this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border)
- ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : this.offset.scroll.left ) * mod)
+ ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : this.offset.scroll.left ) * mod )
)
};
@@ -468,8 +468,7 @@ $.widget("ui.draggable", $.ui.mouse, {
var containment, co, top, left,
o = this.options,
- scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent,
- scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName),
+ scroll = this.cssPosition === "absolute" && !( this.scrollParent[ 0 ] !== document && $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? this.offsetParent : this.scrollParent,
pageX = event.pageX,
pageY = event.pageY;
@@ -530,14 +529,14 @@ $.widget("ui.draggable", $.ui.mouse, {
this.offset.click.top - // Click offset (relative to the element)
this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.parent.top + // The offsetParent's offset without borders (offset + border)
- ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ))
+ ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : this.offset.scroll.top )
),
left: (
pageX - // The absolute mouse position
this.offset.click.left - // Click offset (relative to the element)
this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.parent.left + // The offsetParent's offset without borders (offset + border)
- ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : this.offset.scroll.left ))
+ ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : this.offset.scroll.left )
)
};