Skip to content
Permalink
Browse files

All: Migrate away from deprecated/removed Core APIs

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
  • Loading branch information
mgol committed Dec 8, 2019
1 parent 74f8a0a commit 98b539171b6e805fa79346a5e9896865e5213b9c
Showing with 62,977 additions and 179 deletions.
  1. +1 −0 .gitignore
  2. +51 −29 Gruntfile.js
  3. +6 −0 bower.json
  4. +4 −0 build/tasks/testswarm.js
  5. +2 −1 demos/autocomplete/xml.html
  6. +3 −1 demos/tooltip/video-player.html
  7. +36 −0 external/jquery-3.2.0/LICENSE.txt
  8. +10,244 −0 external/jquery-3.2.0/jquery.js
  9. +36 −0 external/jquery-3.2.1/LICENSE.txt
  10. +10,253 −0 external/jquery-3.2.1/jquery.js
  11. +36 −0 external/jquery-3.3.0/LICENSE.txt
  12. +10,364 −0 external/jquery-3.3.0/jquery.js
  13. +36 −0 external/jquery-3.3.1/LICENSE.txt
  14. +10,364 −0 external/jquery-3.3.1/jquery.js
  15. +20 −0 external/jquery-3.4.0/LICENSE.txt
  16. +10,588 −0 external/jquery-3.4.0/jquery.js
  17. +20 −0 external/jquery-3.4.1/LICENSE.txt
  18. +10,598 −0 external/jquery-3.4.1/jquery.js
  19. +1 −1 external/{jquery-migrate-3.0.0 → jquery-migrate-3.1.0}/LICENSE.txt
  20. +180 −42 external/{jquery-migrate-3.0.0 → jquery-migrate-3.1.0}/jquery-migrate.js
  21. +4 −4 tests/lib/bootstrap.js
  22. +2 −2 tests/lib/common.js
  23. +3 −0 tests/lib/qunit.js
  24. +5 −5 tests/unit/checkboxradio/options.js
  25. +3 −2 tests/unit/core/core.js
  26. +1 −1 tests/unit/dialog/deprecated.js
  27. +13 −9 tests/unit/dialog/options.js
  28. +8 −3 tests/unit/draggable/options.js
  29. +1 −1 tests/unit/effects/core.js
  30. +1 −1 tests/unit/menu/helper.js
  31. +7 −7 tests/unit/selectmenu/core.js
  32. +4 −4 tests/unit/selectmenu/methods.js
  33. +4 −1 tests/unit/subsuite.js
  34. +5 −5 tests/unit/widget/core.js
  35. +1 −1 tests/visual/dialog/performance.html
  36. +28 −22 ui/effect.js
  37. +8 −4 ui/position.js
  38. +5 −4 ui/widget.js
  39. +2 −2 ui/widgets/autocomplete.js
  40. +2 −1 ui/widgets/button.js
  41. +1 −1 ui/widgets/controlgroup.js
  42. +2 −2 ui/widgets/dialog.js
  43. +3 −3 ui/widgets/draggable.js
  44. +2 −2 ui/widgets/droppable.js
  45. +2 −1 ui/widgets/menu.js
  46. +1 −1 ui/widgets/resizable.js
  47. +3 −3 ui/widgets/slider.js
  48. +6 −6 ui/widgets/sortable.js
  49. +1 −1 ui/widgets/spinner.js
  50. +4 −4 ui/widgets/tabs.js
  51. +2 −2 ui/widgets/tooltip.js
@@ -2,3 +2,4 @@ dist
bower_components
node_modules
.sizecache.json
package-lock.json
@@ -3,6 +3,7 @@ module.exports = function( grunt ) {
"use strict";

var

// files
coreFiles = [
"core.js",
@@ -16,11 +17,11 @@ var
"effect.js"
],

uiFiles = coreFiles.map(function( file ) {
uiFiles = coreFiles.map( function( file ) {
return "ui/" + file;
}).concat( expandFiles( "ui/**/*.js" ).filter(function( file ) {
} ).concat( expandFiles( "ui/**/*.js" ).filter( function( file ) {
return coreFiles.indexOf( file.substring( 3 ) ) === -1;
}) ),
} ) ),

allI18nFiles = expandFiles( "ui/i18n/*.js" ),

@@ -45,9 +46,9 @@ var
"tabs",
"tooltip",
"theme"
].map(function( component ) {
].map( function( component ) {
return "themes/base/" + component + ".css";
}),
} ),

// minified files
minify = {
@@ -92,28 +93,30 @@ function mapMinFile( file ) {
}

function expandFiles( files ) {
return grunt.util._.pluck( grunt.file.expandMapping( files ), "src" ).map(function( values ) {
return grunt.util._.pluck( grunt.file.expandMapping( files ), "src" ).map( function( values ) {
return values[ 0 ];
});
} );
}

uiFiles.concat( allI18nFiles ).forEach(function( file ) {
uiFiles.concat( allI18nFiles ).forEach( function( file ) {
minify[ file ] = {
options: {
banner: createBanner()
},
files: {}
};
minify[ file ].files[ mapMinFile( file ) ] = file;
});
} );

uiFiles.forEach( function( file ) {

uiFiles.forEach(function( file ) {
// TODO this doesn't do anything until https://github.com/rwldrn/grunt-compare-size/issues/13
compareFiles[ file ] = [ file, mapMinFile( file ) ];
});
} );

// grunt plugins
require( "load-grunt-tasks" )( grunt );

// local testswarm and build tasks
grunt.loadTasks( "build/tasks" );

@@ -122,17 +125,18 @@ function stripDirectory( file ) {
}

function createBanner( files ) {

// strip folders
var fileNames = files && files.map( stripDirectory );
return "/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - " +
"<%= grunt.template.today('isoDate') %>\n" +
"<%= pkg.homepage ? '* ' + pkg.homepage + '\\n' : '' %>" +
(files ? "* Includes: " + fileNames.join(", ") + "\n" : "") +
( files ? "* Includes: " + fileNames.join( ", " ) + "\n" : "" ) +
"* Copyright <%= pkg.author.name %>;" +
" Licensed <%= _.pluck(pkg.licenses, 'type').join(', ') %> */\n";
}

grunt.initConfig({
grunt.initConfig( {
pkg: grunt.file.readJSON( "package.json" ),
files: {
dist: "<%= pkg.name %>-<%= pkg.version %>"
@@ -166,7 +170,7 @@ grunt.initConfig({
include: expandFiles( [ "ui/**/*.js", "!ui/core.js", "!ui/i18n/*" ] ),
out: "dist/jquery-ui.js",
wrap: {
start: createBanner( uiFiles ),
start: createBanner( uiFiles )
}
}
}
@@ -215,9 +219,9 @@ grunt.initConfig({
}
},
qunit: {
files: expandFiles( "tests/unit/" + component + "/*.html" ).filter(function( file ) {
files: expandFiles( "tests/unit/" + component + "/*.html" ).filter( function( file ) {
return !( /(all|index|test)\.html$/ ).test( file );
}),
} ),
options: {
inject: false,
page: {
@@ -397,6 +401,24 @@ grunt.initConfig({
"jquery-3.1.1/jquery.js": "jquery-3.1.1/dist/jquery.js",
"jquery-3.1.1/LICENSE.txt": "jquery-3.1.1/LICENSE.txt",

"jquery-3.2.0/jquery.js": "jquery-3.2.0/dist/jquery.js",
"jquery-3.2.0/LICENSE.txt": "jquery-3.2.0/LICENSE.txt",

"jquery-3.2.1/jquery.js": "jquery-3.2.1/dist/jquery.js",
"jquery-3.2.1/LICENSE.txt": "jquery-3.2.1/LICENSE.txt",

"jquery-3.3.0/jquery.js": "jquery-3.3.0/dist/jquery.js",
"jquery-3.3.0/LICENSE.txt": "jquery-3.3.0/LICENSE.txt",

"jquery-3.3.1/jquery.js": "jquery-3.3.1/dist/jquery.js",
"jquery-3.3.1/LICENSE.txt": "jquery-3.3.1/LICENSE.txt",

"jquery-3.4.0/jquery.js": "jquery-3.4.0/dist/jquery.js",
"jquery-3.4.0/LICENSE.txt": "jquery-3.4.0/LICENSE.txt",

"jquery-3.4.1/jquery.js": "jquery-3.4.1/dist/jquery.js",
"jquery-3.4.1/LICENSE.txt": "jquery-3.4.1/LICENSE.txt",

"jquery-migrate-1.4.1/jquery-migrate.js": "jquery-migrate-1.4.1/dist/jquery-migrate.js",
"jquery-migrate-1.4.1/LICENSE.txt": "jquery-migrate-1.4.1/LICENSE.txt",

@@ -432,43 +454,43 @@ grunt.initConfig({
"Bohdan Ganicky <bohdan.ganicky@gmail.com>"
]
}
});
} );

grunt.registerTask( "update-authors", function() {
var getAuthors = require( "grunt-git-authors" ).getAuthors,
done = this.async();

getAuthors({
getAuthors( {
priorAuthors: grunt.config( "authors.prior" )
}, function( error, authors ) {
if ( error ) {
grunt.log.error( error );
return done( false );
}

authors = authors.map(function( author ) {
authors = authors.map( function( author ) {
if ( author.match( /^Jacek Jędrzejewski </ ) ) {
return "Jacek Jędrzejewski (http://jacek.jedrzejewski.name)";
} else if ( author.match( /^Pawel Maruszczyk </ ) ) {
return "Pawel Maruszczyk (http://hrabstwo.net)";
} else {
return author;
}
});
} );

grunt.file.write( "AUTHORS.txt",
"Authors ordered by first contribution\n" +
"A list of current team members is available at http://jqueryui.com/about\n\n" +
authors.join( "\n" ) + "\n" );
done();
});
});

grunt.registerTask( "default", [ "lint", "requirejs", "test" ]);
grunt.registerTask( "jenkins", [ "default", "concat" ]);
grunt.registerTask( "lint", [ "asciilint", "jshint", "jscs", "csslint", "htmllint" ]);
grunt.registerTask( "test", [ "qunit" ]);
grunt.registerTask( "sizer", [ "requirejs:js", "uglify:main", "compare_size:all" ]);
grunt.registerTask( "sizer_all", [ "requirejs:js", "uglify", "compare_size" ]);
} );
} );

grunt.registerTask( "default", [ "lint", "requirejs", "test" ] );
grunt.registerTask( "jenkins", [ "default", "concat" ] );
grunt.registerTask( "lint", [ "asciilint", "jshint", "jscs", "csslint", "htmllint" ] );
grunt.registerTask( "test", [ "qunit" ] );
grunt.registerTask( "sizer", [ "requirejs:js", "uglify:main", "compare_size:all" ] );
grunt.registerTask( "sizer_all", [ "requirejs:js", "uglify", "compare_size" ] );

};
@@ -60,6 +60,12 @@
"jquery-3.0.0": "jquery#3.0.0",
"jquery-3.1.0": "jquery#3.1.0",
"jquery-3.1.1": "jquery#3.1.1",
"jquery-3.2.0": "jquery#3.2.0",
"jquery-3.2.1": "jquery#3.2.1",
"jquery-3.3.0": "jquery#3.3.0",
"jquery-3.3.1": "jquery#3.3.1",
"jquery-3.4.0": "jquery#3.4.0",
"jquery-3.4.1": "jquery#3.4.1",
"jquery-migrate-1.4.1": "https://registry.npmjs.org/jquery-migrate/-/jquery-migrate-1.4.1.tgz",
"jquery-migrate-3.0.0": "https://registry.npmjs.org/jquery-migrate/-/jquery-migrate-3.0.0.tgz"
}
@@ -4,6 +4,10 @@ module.exports = function( grunt ) {

var versions = {
"git": "git",
"3.x-git": "3.x-git",
"3.4": "3.4.1",
"3.3": "3.3.1",
"3.2": "3.2.1",
"3.1": "3.1.1",
"3.0": "3.0.0",
"2.2": "2.2.4",
@@ -25,7 +25,8 @@
var data = $( "geoname", xmlResponse ).map(function() {
return {
value: $( "name", this ).text() + ", " +
( $.trim( $( "countryName", this ).text() ) || "(unknown country)" ),
( String.prototype.trim.call( $( "countryName", this ).text() ) ||
"(unknown country)" ),
id: $( "geonameId", this ).text()
};
}).get();
@@ -37,7 +37,9 @@
<script src="../../external/requirejs/require.js"></script>
<script src="../bootstrap.js" data-modules="button controlgroup menu effect effect-blind">
function notify( input ) {
var msg = "Selected " + $.trim( input.data( "tooltip-title" ) || input.text() );
var msg = "Selected " +
String.prototype.trim.call(
input.data( "tooltip-title" ) || input.text() );
$( "<div>" )
.appendTo( document.body )
.text( msg )
@@ -0,0 +1,36 @@
Copyright JS Foundation and other contributors, https://js.foundation/

This software consists of voluntary contributions made by many
individuals. For exact contribution history, see the revision history
available at https://github.com/jquery/jquery

The following license applies to all parts of this software except as
documented below:

====

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

====

All files located in the node_modules and external directories are
externally maintained libraries used by this software which have their
own licenses; we recommend you read them, as their terms may differ from
the terms above.

2 comments on commit 98b5391

@DenisLabrecque

This comment has been minimized.

Copy link

@DenisLabrecque DenisLabrecque replied Jun 22, 2020

Is String.prototype.trim.call( value ) preferred to value.trim()?

@mgol

This comment has been minimized.

Copy link
Member Author

@mgol mgol replied Jun 22, 2020

@DenisLabrecque Usually not, unless you're not sure if value is a string.

Please sign in to comment.
You can’t perform that action at this time.