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

Fixes jQuery migrate error when getting offset when dropdownParent not in document #5644

Merged
merged 2 commits into from Sep 19, 2019

Conversation

kevin-brown
Copy link
Member

This pull request includes a

  • Bug fix
  • New feature
  • Translation

The following changes were made

  • AttachBody now checks that dropdownParent is in the document before getting the offset
  • Added a quick test to make sure this consistently happens

If this is related to an existing ticket, include a link to it as well.

Fixes #5584 .

This fixes an error which is called out in jQuery Migrate but
probably never happens in real life. This is because we call
`jQuery.fn.offset` without checking if the element is in the
document. Based on testing done here and within the MediaWiki
team, I'm pretty sure jQuery never actually implemented explicit
checks and this jQuery Migrate warning is just to cover the case
where a browser might start returning inconsistnet results. And
we could at least reproduce the inconsistency, so that's something.

We now default the offset to 0/0 if the parent element happens to
not be in the document. This appears to be what jQuery used to do
in the past, and generally appears to be what people expect in
these cases.

This fixes #5584.
@kevin-brown kevin-brown added this to the 4.0.11 milestone Sep 19, 2019
@kevin-brown kevin-brown merged commit 7c4131b into develop Sep 19, 2019
@kevin-brown kevin-brown deleted the GH-5584 branch September 19, 2019 01:56
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

Successfully merging this pull request may close these issues.

None yet

1 participant