Skip to content

All: Migrate away from deprecated/removed Core APIs #1901

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

Merged
merged 14 commits into from
Dec 8, 2019

Conversation

mgol
Copy link
Member

@mgol mgol commented Oct 20, 2019

With this patch & the upcoming jQuery Color update the UI master branch passes more or less the same tests with jQuery master as with jQuery 3.4.1. Before it gets applied, it fails completely, hanging TestSwarm.

mgol added 8 commits October 20, 2019 19:45
jQuery.isArray will be removed in jQuery 4.0.
jQuery.isFunction will be removed in jQuery 4.0.
A jQuery object was created, chained & assigned to a variable that was then
accessed in a callback used inside of this chained definition. Due to a timing
difference in when the callback fired for the first time in latest jQuery
master, it was being called before the variable was defined.

This has been resolved now.
Newest jQuery returns fractional results in some cases, making comparisons
fail when there's a tiny difference. Tests were modified to be less strict.
@mgol
Copy link
Member Author

mgol commented Oct 20, 2019

I’d appreciate a review from @jquery/core. Commit by commit might be the easiest.

@mgol
Copy link
Member Author

mgol commented Oct 20, 2019

Also, cc @arschmitz @fnagel

@mgol mgol force-pushed the core-compat branch 3 times, most recently from ad53219 to 8d307c9 Compare October 21, 2019 22:15
@fnagel fnagel self-requested a review October 22, 2019 16:06
Copy link
Member

@fnagel fnagel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 by reading. Looks good!

@@ -14,7 +14,7 @@ return $.extend( helper, {
if ( message === undefined ) {
message = lastItem;
}
log.push( $.trim( message ) );
log.push( String.prototype.trim.call( message ) );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my mind, this calls into question the replacement of $.trim(…) with ….trim() in source files. Since the PR isn't intended to make any changes other than restoring functionality, perhaps we should be doing String.prototype.trim.call(…) everywhere (or defining a local trim function and using that, like you're doing with isWindow).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gibson042 I changed the order of commits to make the $.trim changes the last one and modified all replacements to use String.prototype.trim.call instead, as you advised.

While an util would be easier to use, I don't see any infrastructure in UI to create internal utility modules that can be used in other files and this change is needed in various parts of the repository. Not wanting to expose anything new on $.ui (even if "internal" in theory), I went for String.prototype.trim.call.

@mattbrundage
Copy link
Contributor

Pull request #1887 should be evaluated as well.

@mgol mgol changed the title Migrate away from deprecated/removed Core APIs All: Migrate away from deprecated/removed Core APIs Dec 8, 2019
@mgol mgol merged commit 77c8a85 into jquery:master Dec 8, 2019
@mgol mgol deleted the core-compat branch December 8, 2019 21:19
mgol added a commit that referenced this pull request Dec 8, 2019
Summary of the changes:

* Build: Add jQuery 3.2.0-3.4.1 to versions UI can be tested against
* Build: Load jQuery & Migrate via HTTPS
* Build: Add package-lock.json to .gitignore
* Build: Update jQuery Migrate from 3.0.0 to 3.1.0
* Build: Allow to run tests against jQuery 3.x-git
* Build: Fix formatting according to JSCS rules
* Build: Disable JSCS for the inlined jQuery Color
* All: Switch from $.isArray to Array.isArray (jQuery.isArray will be
  removed in jQuery 4.0)
* All: Switch from `$.isFunction( x )` to `typeof x === "function"`
  (jQuery.isFunction will be removed in jQuery 4.0)
* All: Inline jQuery.isWindow as it'll be removed in jQuery 4.0
* Effects: Fix a timing issue in a variable declaration. Previously,
  a jQuery object was created, chained & assigned to a variable that
  was then accessed in a callback used inside of this chained
  definition. Due to a timing difference in when the callback fired for
  the first time in latest jQuery master, it was being called before
  the variable was defined.
* Tests: Make dialog & draggable unit tests less strict (newest jQuery
  returns fractional results in some cases, making comparisons fail when
  there's a tiny difference)
* All: Migrate from $.trim to bare String.prototype.trim (jQuery.trim
  will be deprecated in jQuery 3.5)

Closes gh-1901
@mgol
Copy link
Member Author

mgol commented Dec 8, 2019

Landed in 98b5391.

@melloware
Copy link

@mgol does this mean there is a Jquery UI release coming soon? it has been almost 3 years since last release.

@mgol
Copy link
Member Author

mgol commented Dec 9, 2019

@melloware While I have commit access to this repository, I'm a member of the jQuery Core team, not the jQuery UI team. My primary goal here is to make UI compatible with recent jQuery versions and to prepare it as much as possible for a future jQuery 4.0 release. In this way people using jQuery UI won't be blocked from jQuery Core updates. When those compatibility updates are done, we'll want to do a UI release.

I can't guarantee issues not related to Core compatibility will be addressed, though, that depends on whether people more familiar with UI internals review/merge PRs that touch them.

@mgol mgol added this to the 1.13 milestone Jun 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

6 participants