-
Notifications
You must be signed in to change notification settings - Fork 5.3k
All: Resolve most jQuery Migrate warnings #1919
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
Conversation
eacb8e3
to
e2a60e3
Compare
@@ -331,7 +331,7 @@ $.widget( "ui.tooltip", { | |||
position( positionOption.of ); | |||
clearInterval( delayedShow ); | |||
} | |||
}, $.fx.interval ); | |||
}, 13 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want a comment here why its 13?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. This is copied from the $.fx.interval
value & follows the advice from https://github.com/jquery/jquery-migrate/blob/master/warnings.md#jqmigrate-jqueryfxinterval-is-deprecated
ui/safe-offset.js
Outdated
|
||
// Simulate a jQuery short-circuiting when there are no client rects reported | ||
// which usually means a disconnected node. This check in jQuery is meant just | ||
// for IE but UI depends on it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for my understanding: this check is implemented in jQuery for IE only, bit UI needs it in every browser, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not exactly. jQuery has a check meant for IE but it's run by all browsers so by pure coincidence it makes UI not hit errors here. This is about these lines:
https://github.com/jquery/jquery/blob/3.5.1/src/offset.js#L98-L104
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about:
// for IE but UI depends on it. | |
// for IE but is applied in all browsers & UI depends on it. |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't understand why we need this in jQueryUI when its already in jQuery... sorry, my mind is a little slow today ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See https://jquery.com/upgrade-guide/3.0/#breaking-change-invalid-input-to-the-offset-method
jQuery 3.0.0 & newer require DOM elements with the getBoundingClientRect
method. It's just that jQuery needs to run a check for getClientRects()
due to the comment above the lines I linked, to workaround an IE issue. We shouldn't rely on this check for other purposes.
Also, jQuery Migrate warns if you use offset()
in such a way.
That said, now I see the discussion in jquery/jquery#2310 so maybe I need to re-read it & make sure Migrate is not warning too much.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahhh, got it. Thanks for the explanation and your patience :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fnagel Thank you for raising these concerns! This change will most likely not be needed as we'll update Migrate instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 by reading
This also adds a new internalthis part is now extracted to #1922.$.ui.__safeOffset__
method to provide a similar support to past jQuery versions while avoiding Migrate warnings.