johnny / johnny/jquery-sortable
Update required for jQuery 3.x - jQuery.fn.offset() requires an element connected to a document
- Dominant language
- HTML
- Stars
- 1.5k
- Forks
- 429
- PR merge metrics
- No merged PRs in 30d
Description
I was encountering the following warning while using jquery-sortable 0.9.13 (from 2015) with jQuery 3.2.1 and the unminified version of jQuery Migrate 3.1.0.
> jQuery.fn.offset() requires an element connected to a document
I reviewed the sortable plugin, determined what jQuery Migrate was doing to provide fallback support and made the following edit to function `getRelativePosition()` on line 190.
function getRelativePosition(pointer, element) {
var docElem = ( element.ownerDocument || window.document ).documentElement;
var offset = { top: 0, left: 0 };
if ( $.contains(docElem, element) ) {
offset = element.offset();
}
...
This appears to works correctly now with jQuery 3.x. Please review and determine if there are any problems with this approach. Thanks.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.