From cb07a80d83b2bf30683fcb303e28eff096122b5e Mon Sep 17 00:00:00 2001 From: Adam Zielinski Date: Sat, 28 Sep 2013 19:35:36 +0200 Subject: [PATCH 1/2] Fixed calculation of "a special case where we need to modify a offset calculated on start" It was altering parentOffset under wrong condition - scrollParent was compared to document instead of document.body --- ui/jquery.ui.sortable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/jquery.ui.sortable.js b/ui/jquery.ui.sortable.js index 9c7bf446cda..8bb863d5425 100644 --- a/ui/jquery.ui.sortable.js +++ b/ui/jquery.ui.sortable.js @@ -954,7 +954,7 @@ $.widget("ui.sortable", $.ui.mouse, { // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag - if(this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) { + if(this.cssPosition === "absolute" && this.scrollParent[0] !== document && this.scrollParent[0] !== document.body && $.contains(this.scrollParent[0], this.offsetParent[0])) { po.left += this.scrollParent.scrollLeft(); po.top += this.scrollParent.scrollTop(); } From 3dbdfeec55737b95e1d87aa917e88149fd250a60 Mon Sep 17 00:00:00 2001 From: Adam Zielinski Date: Wed, 13 Nov 2013 11:12:40 +0100 Subject: [PATCH 2/2] Added a comment explaining previous modification --- ui/jquery.ui.sortable.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/jquery.ui.sortable.js b/ui/jquery.ui.sortable.js index 8bb863d5425..65d94180c78 100644 --- a/ui/jquery.ui.sortable.js +++ b/ui/jquery.ui.sortable.js @@ -954,6 +954,9 @@ $.widget("ui.sortable", $.ui.mouse, { // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag + // + // this.scrollParent[0] !== document.body <-- this condition was added in order to deal with the following WebKit issue: + // https://code.google.com/p/chromium/issues/detail?id=157855 if(this.cssPosition === "absolute" && this.scrollParent[0] !== document && this.scrollParent[0] !== document.body && $.contains(this.scrollParent[0], this.offsetParent[0])) { po.left += this.scrollParent.scrollLeft(); po.top += this.scrollParent.scrollTop();