Skip to content

Commit 98b5391

Browse files
committed
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 jquerygh-1901
1 parent 74f8a0a commit 98b5391

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+62977
-179
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ dist
22
bower_components
33
node_modules
44
.sizecache.json
5+
package-lock.json

Gruntfile.js

Lines changed: 51 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module.exports = function( grunt ) {
33
"use strict";
44

55
var
6+
67
// files
78
coreFiles = [
89
"core.js",
@@ -16,11 +17,11 @@ var
1617
"effect.js"
1718
],
1819

19-
uiFiles = coreFiles.map(function( file ) {
20+
uiFiles = coreFiles.map( function( file ) {
2021
return "ui/" + file;
21-
}).concat( expandFiles( "ui/**/*.js" ).filter(function( file ) {
22+
} ).concat( expandFiles( "ui/**/*.js" ).filter( function( file ) {
2223
return coreFiles.indexOf( file.substring( 3 ) ) === -1;
23-
}) ),
24+
} ) ),
2425

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

@@ -45,9 +46,9 @@ var
4546
"tabs",
4647
"tooltip",
4748
"theme"
48-
].map(function( component ) {
49+
].map( function( component ) {
4950
return "themes/base/" + component + ".css";
50-
}),
51+
} ),
5152

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

9495
function expandFiles( files ) {
95-
return grunt.util._.pluck( grunt.file.expandMapping( files ), "src" ).map(function( values ) {
96+
return grunt.util._.pluck( grunt.file.expandMapping( files ), "src" ).map( function( values ) {
9697
return values[ 0 ];
97-
});
98+
} );
9899
}
99100

100-
uiFiles.concat( allI18nFiles ).forEach(function( file ) {
101+
uiFiles.concat( allI18nFiles ).forEach( function( file ) {
101102
minify[ file ] = {
102103
options: {
103104
banner: createBanner()
104105
},
105106
files: {}
106107
};
107108
minify[ file ].files[ mapMinFile( file ) ] = file;
108-
});
109+
} );
110+
111+
uiFiles.forEach( function( file ) {
109112

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

115117
// grunt plugins
116118
require( "load-grunt-tasks" )( grunt );
119+
117120
// local testswarm and build tasks
118121
grunt.loadTasks( "build/tasks" );
119122

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

124127
function createBanner( files ) {
128+
125129
// strip folders
126130
var fileNames = files && files.map( stripDirectory );
127131
return "/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - " +
128132
"<%= grunt.template.today('isoDate') %>\n" +
129133
"<%= pkg.homepage ? '* ' + pkg.homepage + '\\n' : '' %>" +
130-
(files ? "* Includes: " + fileNames.join(", ") + "\n" : "") +
134+
( files ? "* Includes: " + fileNames.join( ", " ) + "\n" : "" ) +
131135
"* Copyright <%= pkg.author.name %>;" +
132136
" Licensed <%= _.pluck(pkg.licenses, 'type').join(', ') %> */\n";
133137
}
134138

135-
grunt.initConfig({
139+
grunt.initConfig( {
136140
pkg: grunt.file.readJSON( "package.json" ),
137141
files: {
138142
dist: "<%= pkg.name %>-<%= pkg.version %>"
@@ -166,7 +170,7 @@ grunt.initConfig({
166170
include: expandFiles( [ "ui/**/*.js", "!ui/core.js", "!ui/i18n/*" ] ),
167171
out: "dist/jquery-ui.js",
168172
wrap: {
169-
start: createBanner( uiFiles ),
173+
start: createBanner( uiFiles )
170174
}
171175
}
172176
}
@@ -215,9 +219,9 @@ grunt.initConfig({
215219
}
216220
},
217221
qunit: {
218-
files: expandFiles( "tests/unit/" + component + "/*.html" ).filter(function( file ) {
222+
files: expandFiles( "tests/unit/" + component + "/*.html" ).filter( function( file ) {
219223
return !( /(all|index|test)\.html$/ ).test( file );
220-
}),
224+
} ),
221225
options: {
222226
inject: false,
223227
page: {
@@ -397,6 +401,24 @@ grunt.initConfig({
397401
"jquery-3.1.1/jquery.js": "jquery-3.1.1/dist/jquery.js",
398402
"jquery-3.1.1/LICENSE.txt": "jquery-3.1.1/LICENSE.txt",
399403

404+
"jquery-3.2.0/jquery.js": "jquery-3.2.0/dist/jquery.js",
405+
"jquery-3.2.0/LICENSE.txt": "jquery-3.2.0/LICENSE.txt",
406+
407+
"jquery-3.2.1/jquery.js": "jquery-3.2.1/dist/jquery.js",
408+
"jquery-3.2.1/LICENSE.txt": "jquery-3.2.1/LICENSE.txt",
409+
410+
"jquery-3.3.0/jquery.js": "jquery-3.3.0/dist/jquery.js",
411+
"jquery-3.3.0/LICENSE.txt": "jquery-3.3.0/LICENSE.txt",
412+
413+
"jquery-3.3.1/jquery.js": "jquery-3.3.1/dist/jquery.js",
414+
"jquery-3.3.1/LICENSE.txt": "jquery-3.3.1/LICENSE.txt",
415+
416+
"jquery-3.4.0/jquery.js": "jquery-3.4.0/dist/jquery.js",
417+
"jquery-3.4.0/LICENSE.txt": "jquery-3.4.0/LICENSE.txt",
418+
419+
"jquery-3.4.1/jquery.js": "jquery-3.4.1/dist/jquery.js",
420+
"jquery-3.4.1/LICENSE.txt": "jquery-3.4.1/LICENSE.txt",
421+
400422
"jquery-migrate-1.4.1/jquery-migrate.js": "jquery-migrate-1.4.1/dist/jquery-migrate.js",
401423
"jquery-migrate-1.4.1/LICENSE.txt": "jquery-migrate-1.4.1/LICENSE.txt",
402424

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

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

441-
getAuthors({
463+
getAuthors( {
442464
priorAuthors: grunt.config( "authors.prior" )
443465
}, function( error, authors ) {
444466
if ( error ) {
445467
grunt.log.error( error );
446468
return done( false );
447469
}
448470

449-
authors = authors.map(function( author ) {
471+
authors = authors.map( function( author ) {
450472
if ( author.match( /^Jacek Jędrzejewski </ ) ) {
451473
return "Jacek Jędrzejewski (http://jacek.jedrzejewski.name)";
452474
} else if ( author.match( /^Pawel Maruszczyk </ ) ) {
453475
return "Pawel Maruszczyk (http://hrabstwo.net)";
454476
} else {
455477
return author;
456478
}
457-
});
479+
} );
458480

459481
grunt.file.write( "AUTHORS.txt",
460482
"Authors ordered by first contribution\n" +
461483
"A list of current team members is available at http://jqueryui.com/about\n\n" +
462484
authors.join( "\n" ) + "\n" );
463485
done();
464-
});
465-
});
466-
467-
grunt.registerTask( "default", [ "lint", "requirejs", "test" ]);
468-
grunt.registerTask( "jenkins", [ "default", "concat" ]);
469-
grunt.registerTask( "lint", [ "asciilint", "jshint", "jscs", "csslint", "htmllint" ]);
470-
grunt.registerTask( "test", [ "qunit" ]);
471-
grunt.registerTask( "sizer", [ "requirejs:js", "uglify:main", "compare_size:all" ]);
472-
grunt.registerTask( "sizer_all", [ "requirejs:js", "uglify", "compare_size" ]);
486+
} );
487+
} );
488+
489+
grunt.registerTask( "default", [ "lint", "requirejs", "test" ] );
490+
grunt.registerTask( "jenkins", [ "default", "concat" ] );
491+
grunt.registerTask( "lint", [ "asciilint", "jshint", "jscs", "csslint", "htmllint" ] );
492+
grunt.registerTask( "test", [ "qunit" ] );
493+
grunt.registerTask( "sizer", [ "requirejs:js", "uglify:main", "compare_size:all" ] );
494+
grunt.registerTask( "sizer_all", [ "requirejs:js", "uglify", "compare_size" ] );
473495

474496
};

bower.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@
6060
"jquery-3.0.0": "jquery#3.0.0",
6161
"jquery-3.1.0": "jquery#3.1.0",
6262
"jquery-3.1.1": "jquery#3.1.1",
63+
"jquery-3.2.0": "jquery#3.2.0",
64+
"jquery-3.2.1": "jquery#3.2.1",
65+
"jquery-3.3.0": "jquery#3.3.0",
66+
"jquery-3.3.1": "jquery#3.3.1",
67+
"jquery-3.4.0": "jquery#3.4.0",
68+
"jquery-3.4.1": "jquery#3.4.1",
6369
"jquery-migrate-1.4.1": "https://registry.npmjs.org/jquery-migrate/-/jquery-migrate-1.4.1.tgz",
6470
"jquery-migrate-3.0.0": "https://registry.npmjs.org/jquery-migrate/-/jquery-migrate-3.0.0.tgz"
6571
}

build/tasks/testswarm.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ module.exports = function( grunt ) {
44

55
var versions = {
66
"git": "git",
7+
"3.x-git": "3.x-git",
8+
"3.4": "3.4.1",
9+
"3.3": "3.3.1",
10+
"3.2": "3.2.1",
711
"3.1": "3.1.1",
812
"3.0": "3.0.0",
913
"2.2": "2.2.4",

demos/autocomplete/xml.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
var data = $( "geoname", xmlResponse ).map(function() {
2626
return {
2727
value: $( "name", this ).text() + ", " +
28-
( $.trim( $( "countryName", this ).text() ) || "(unknown country)" ),
28+
( String.prototype.trim.call( $( "countryName", this ).text() ) ||
29+
"(unknown country)" ),
2930
id: $( "geonameId", this ).text()
3031
};
3132
}).get();

demos/tooltip/video-player.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@
3737
<script src="../../external/requirejs/require.js"></script>
3838
<script src="../bootstrap.js" data-modules="button controlgroup menu effect effect-blind">
3939
function notify( input ) {
40-
var msg = "Selected " + $.trim( input.data( "tooltip-title" ) || input.text() );
40+
var msg = "Selected " +
41+
String.prototype.trim.call(
42+
input.data( "tooltip-title" ) || input.text() );
4143
$( "<div>" )
4244
.appendTo( document.body )
4345
.text( msg )

external/jquery-3.2.0/LICENSE.txt

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Copyright JS Foundation and other contributors, https://js.foundation/
2+
3+
This software consists of voluntary contributions made by many
4+
individuals. For exact contribution history, see the revision history
5+
available at https://github.com/jquery/jquery
6+
7+
The following license applies to all parts of this software except as
8+
documented below:
9+
10+
====
11+
12+
Permission is hereby granted, free of charge, to any person obtaining
13+
a copy of this software and associated documentation files (the
14+
"Software"), to deal in the Software without restriction, including
15+
without limitation the rights to use, copy, modify, merge, publish,
16+
distribute, sublicense, and/or sell copies of the Software, and to
17+
permit persons to whom the Software is furnished to do so, subject to
18+
the following conditions:
19+
20+
The above copyright notice and this permission notice shall be
21+
included in all copies or substantial portions of the Software.
22+
23+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30+
31+
====
32+
33+
All files located in the node_modules and external directories are
34+
externally maintained libraries used by this software which have their
35+
own licenses; we recommend you read them, as their terms may differ from
36+
the terms above.

0 commit comments

Comments
 (0)