Lock jqmigrate w/ yarn, minor version bump.

This commit is contained in:
Dannon Baker
2017-08-22 07:53:39 -04:00
parent 966c08754e
commit f179c87a07
8 changed files with 113 additions and 70 deletions
@@ -1,14 +1,14 @@
/*!
* jQuery Migrate - v1.4.0 - 2016-02-26
* Copyright jQuery Foundation and other contributors
*/
/*!
* jQuery Migrate - v1.4.1 - 2016-05-19
* Copyright jQuery Foundation and other contributors
*/
(function( jQuery, window, undefined ) {
// See http://bugs.jquery.com/ticket/13335
// "use strict";
jQuery.migrateVersion = "1.4.0";
jQuery.migrateVersion = "1.4.1";
var warnedAbout = {};
@@ -82,7 +82,7 @@ if ( document.compatMode === "BackCompat" ) {
// jQuery has never supported or tested Quirks Mode
migrateWarn( "jQuery is not compatible with Quirks Mode" );
}
var attrFn = jQuery( "<input/>", { size: 1 } ).attr("size") && jQuery.attrFn,
oldAttr = jQuery.attr,
@@ -189,13 +189,15 @@ jQuery.attrHooks.value = {
elem.value = value;
}
};
var matched, browser,
oldInit = jQuery.fn.init,
oldFind = jQuery.find,
oldParseJSON = jQuery.parseJSON,
rspaceAngle = /^\s*</,
rattrHash = /\[\s*\w+\s*[~|^$*]?=\s*(?![\s'"])[^#\]]*#/,
rattrHashTest = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/,
rattrHashGlob = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/g,
// Note: XSS check is done below after string is trimmed
rquickExpr = /^([^<]*)(<[\w\W]+>)([^>]*)$/;
@@ -203,45 +205,37 @@ var matched, browser,
jQuery.fn.init = function( selector, context, rootjQuery ) {
var match, ret;
if ( selector && typeof selector === "string" && !jQuery.isPlainObject( context ) &&
(match = rquickExpr.exec( jQuery.trim( selector ) )) && match[ 0 ] ) {
// This is an HTML string according to the "old" rules; is it still?
if ( !rspaceAngle.test( selector ) ) {
migrateWarn("$(html) HTML strings must start with '<' character");
}
if ( match[ 3 ] ) {
migrateWarn("$(html) HTML text after last tag is ignored");
}
if ( selector && typeof selector === "string" ) {
if ( !jQuery.isPlainObject( context ) &&
(match = rquickExpr.exec( jQuery.trim( selector ) )) && match[ 0 ] ) {
// Consistently reject any HTML-like string starting with a hash (#9521)
// Note that this may break jQuery 1.6.x code that otherwise would work.
if ( match[ 0 ].charAt( 0 ) === "#" ) {
migrateWarn("HTML string cannot start with a '#' character");
jQuery.error("JQMIGRATE: Invalid selector string (XSS)");
// This is an HTML string according to the "old" rules; is it still?
if ( !rspaceAngle.test( selector ) ) {
migrateWarn("$(html) HTML strings must start with '<' character");
}
if ( match[ 3 ] ) {
migrateWarn("$(html) HTML text after last tag is ignored");
}
// Consistently reject any HTML-like string starting with a hash (gh-9521)
// Note that this may break jQuery 1.6.x code that otherwise would work.
if ( match[ 0 ].charAt( 0 ) === "#" ) {
migrateWarn("HTML string cannot start with a '#' character");
jQuery.error("JQMIGRATE: Invalid selector string (XSS)");
}
// Now process using loose rules; let pre-1.8 play too
// Is this a jQuery context? parseHTML expects a DOM element (#178)
if ( context && context.context && context.context.nodeType ) {
context = context.context;
}
if ( jQuery.parseHTML ) {
return oldInit.call( this,
jQuery.parseHTML( match[ 2 ], context && context.ownerDocument ||
context || document, true ), context, rootjQuery );
}
}
// Now process using loose rules; let pre-1.8 play too
if ( context && context.context ) {
// jQuery object as context; parseHTML expects a DOM object
context = context.context;
}
if ( jQuery.parseHTML ) {
return oldInit.call( this,
jQuery.parseHTML( match[ 2 ], context && context.ownerDocument ||
context || document, true ), context, rootjQuery );
}
}
if ( selector === "#" ) {
// jQuery( "#" ) is a bogus ID selector, but it returned an empty set before jQuery 3.0
migrateWarn( "jQuery( '#' ) is not a valid selector" );
selector = [];
} else if ( rattrHash.test( selector ) ) {
// The nonstandard and undocumented unquoted-hash was removed in jQuery 1.12.0
// Note that this doesn't actually fix the selector due to potential false positives
migrateWarn( "Attribute selectors with '#' must be quoted: '" + selector + "'" );
}
ret = oldInit.apply( this, arguments );
@@ -263,6 +257,47 @@ jQuery.fn.init = function( selector, context, rootjQuery ) {
};
jQuery.fn.init.prototype = jQuery.fn;
jQuery.find = function( selector ) {
var args = Array.prototype.slice.call( arguments );
// Support: PhantomJS 1.x
// String#match fails to match when used with a //g RegExp, only on some strings
if ( typeof selector === "string" && rattrHashTest.test( selector ) ) {
// The nonstandard and undocumented unquoted-hash was removed in jQuery 1.12.0
// First see if qS thinks it's a valid selector, if so avoid a false positive
try {
document.querySelector( selector );
} catch ( err1 ) {
// Didn't *look* valid to qSA, warn and try quoting what we think is the value
selector = selector.replace( rattrHashGlob, function( _, attr, op, value ) {
return "[" + attr + op + "\"" + value + "\"]";
} );
// If the regexp *may* have created an invalid selector, don't update it
// Note that there may be false alarms if selector uses jQuery extensions
try {
document.querySelector( selector );
migrateWarn( "Attribute selector with '#' must be quoted: " + args[ 0 ] );
args[ 0 ] = selector;
} catch ( err2 ) {
migrateWarn( "Attribute selector with '#' was not fixed: " + args[ 0 ] );
}
}
}
return oldFind.apply( this, args );
};
// Copy properties attached to original jQuery.find method (e.g. .attr, .isXML)
var findProp;
for ( findProp in oldFind ) {
if ( Object.prototype.hasOwnProperty.call( oldFind, findProp ) ) {
jQuery.find[ findProp ] = oldFind[ findProp ];
}
}
// Let $.parseJSON(falsy_value) return null
jQuery.parseJSON = function( json ) {
if ( !json ) {
@@ -342,7 +377,7 @@ jQuery.fn.size = function() {
migrateWarn( "jQuery.fn.size() is deprecated; use the .length property" );
return this.length;
};
var internalSwapCall = false;
@@ -387,7 +422,7 @@ jQuery.swap = function( elem, options, callback, args ) {
return ret;
};
// Ensure that $.ajax gets the new parseJSON defined in core.js
jQuery.ajaxSetup({
@@ -395,7 +430,7 @@ jQuery.ajaxSetup({
"text json": jQuery.parseJSON
}
});
var oldFnData = jQuery.fn.data;
@@ -414,7 +449,7 @@ jQuery.fn.data = function( name ) {
}
return oldFnData.apply( this, arguments );
};
var rscriptType = /\/(java|ecma)script/i;
@@ -467,7 +502,7 @@ if ( !jQuery.clean ) {
return ret;
};
}
var eventAdd = jQuery.event.add,
eventRemove = jQuery.event.remove,
eventTrigger = jQuery.event.trigger,
@@ -629,9 +664,9 @@ jQuery.event.special.ready = {
}
}
};
var oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack,
oldFind = jQuery.fn.find;
oldFnFind = jQuery.fn.find;
jQuery.fn.andSelf = function() {
migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()");
@@ -639,12 +674,12 @@ jQuery.fn.andSelf = function() {
};
jQuery.fn.find = function( selector ) {
var ret = oldFind.apply( this, arguments );
var ret = oldFnFind.apply( this, arguments );
ret.context = this.context;
ret.selector = this.selector ? this.selector + " " + selector : selector;
return ret;
};
// jQuery 1.6 did not support Callbacks, do not warn there
if ( jQuery.Callbacks ) {
@@ -712,6 +747,6 @@ if ( jQuery.Callbacks ) {
return deferred;
};
}
})( jQuery, window );
}
})( jQuery, window );
-3
View File
@@ -10,9 +10,6 @@ module.exports = function( grunt ){
// where to move fetched bower components into the build structure (libName: [ bower-location, libs-location ])
libraryLocations = {
'jquery': [ 'dist/jquery.js', 'jquery/jquery.js' ],
'jquery-migrate': [ 'jquery-migrate.js', 'jquery/jquery.migrate.js' ],
'underscore': [ 'underscore.js', 'underscore.js' ],
'backbone': [ 'backbone.js', 'backbone.js' ],
'requirejs': [ 'require.js', 'require.js' ],
'd3': [ 'd3.js', 'd3.js' ],
+6
View File
@@ -17,7 +17,11 @@ var paths = {
'!galaxy/scripts/libs/**/*.js'
],
lib_locs: {
// This is a stepping stone towards having all this staged
// automatically. Eventually, this dictionary and staging step will
// not be necessary.
'jquery':['dist/jquery.js', 'jquery/jquery.js'],
'jquery-migrate': [ 'dist/jquery-migrate.js', 'jquery/jquery.migrate.js' ],
'raven-js': ['dist/raven.js', 'raven.js'],
'underscore': [ 'underscore.js', 'underscore.js' ],
},
@@ -42,6 +46,8 @@ gulp.task('stage-libs', function(){
console.log(p1 + " -> " + p2);
del.sync(p2);
fs.createReadStream(p1).pipe(fs.createWriteStream(p2));
} else {
console.log(p1 + " does not exist, this is an error.");
}
});
});
+1
View File
@@ -34,6 +34,7 @@
"gulp-uglify": "^3.0.0",
"gulp-watch": "^4.3.11",
"jquery": "1.12",
"jquery-migrate": "~1.4",
"jshint": "^2.9.4",
"raven-js": "^3.17.0",
"underscore": "^1.8.3",
+4
View File
@@ -2634,6 +2634,10 @@ jpeg-js@^0.1.1:
version "0.1.2"
resolved "https://registry.yarnpkg.com/jpeg-js/-/jpeg-js-0.1.2.tgz#135b992c0575c985cfa0f494a3227ed238583ece"
jquery-migrate@~1.4:
version "1.4.1"
resolved "https://registry.yarnpkg.com/jquery-migrate/-/jquery-migrate-1.4.1.tgz#85152f3ec99a95625f4f7d0bcf62e9b8638f5a76"
jquery@1.12:
version "1.12.4"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-1.12.4.tgz#01e1dfba290fe73deba77ceeacb0f9ba2fec9e0c"
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long