Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update required for jQuery 3.x - jQuery.fn.offset() requires an element connected to a document #278

Open
JamoCA opened this issue Dec 11, 2019 · 0 comments

Comments

@JamoCA
Copy link

JamoCA commented Dec 11, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant