author | ymh <ymh.work@gmail.com> |
Wed, 21 Sep 2022 18:19:35 +0200 | |
changeset 18 | be944660c56a |
parent 9 | 177826044cd9 |
child 21 | 48c4eec2b7e6 |
permissions | -rw-r--r-- |
18 | 1 |
/*! |
2 |
* jQuery Migrate - v3.3.2 - 2020-11-18T08:29Z |
|
3 |
* Copyright OpenJS Foundation and other contributors |
|
4 |
*/ |
|
5 |
( function( factory ) { |
|
6 |
"use strict"; |
|
7 |
||
8 |
if ( typeof define === "function" && define.amd ) { |
|
9 |
||
10 |
// AMD. Register as an anonymous module. |
|
11 |
define( [ "jquery" ], function( jQuery ) { |
|
12 |
return factory( jQuery, window ); |
|
13 |
} ); |
|
14 |
} else if ( typeof module === "object" && module.exports ) { |
|
15 |
||
16 |
// Node/CommonJS |
|
17 |
// eslint-disable-next-line no-undef |
|
18 |
module.exports = factory( require( "jquery" ), window ); |
|
19 |
} else { |
|
20 |
||
21 |
// Browser globals |
|
22 |
factory( jQuery, window ); |
|
23 |
} |
|
24 |
} )( function( jQuery, window ) { |
|
25 |
"use strict"; |
|
26 |
||
27 |
jQuery.migrateVersion = "3.3.2"; |
|
28 |
||
29 |
// Returns 0 if v1 == v2, -1 if v1 < v2, 1 if v1 > v2 |
|
30 |
function compareVersions( v1, v2 ) { |
|
31 |
var i, |
|
32 |
rVersionParts = /^(\d+)\.(\d+)\.(\d+)/, |
|
33 |
v1p = rVersionParts.exec( v1 ) || [ ], |
|
34 |
v2p = rVersionParts.exec( v2 ) || [ ]; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
35 |
|
18 | 36 |
for ( i = 1; i <= 3; i++ ) { |
37 |
if ( +v1p[ i ] > +v2p[ i ] ) { |
|
38 |
return 1; |
|
39 |
} |
|
40 |
if ( +v1p[ i ] < +v2p[ i ] ) { |
|
41 |
return -1; |
|
42 |
} |
|
43 |
} |
|
44 |
return 0; |
|
45 |
} |
|
46 |
||
47 |
function jQueryVersionSince( version ) { |
|
48 |
return compareVersions( jQuery.fn.jquery, version ) >= 0; |
|
49 |
} |
|
50 |
||
51 |
( function() { |
|
52 |
||
53 |
// Support: IE9 only |
|
54 |
// IE9 only creates console object when dev tools are first opened |
|
55 |
// IE9 console is a host object, callable but doesn't have .apply() |
|
56 |
if ( !window.console || !window.console.log ) { |
|
57 |
return; |
|
58 |
} |
|
59 |
||
60 |
// Need jQuery 3.0.0+ and no older Migrate loaded |
|
61 |
if ( !jQuery || !jQueryVersionSince( "3.0.0" ) ) { |
|
62 |
window.console.log( "JQMIGRATE: jQuery 3.0.0+ REQUIRED" ); |
|
63 |
} |
|
64 |
if ( jQuery.migrateWarnings ) { |
|
65 |
window.console.log( "JQMIGRATE: Migrate plugin loaded multiple times" ); |
|
66 |
} |
|
67 |
||
68 |
// Show a message on the console so devs know we're active |
|
69 |
window.console.log( "JQMIGRATE: Migrate is installed" + |
|
70 |
( jQuery.migrateMute ? "" : " with logging active" ) + |
|
71 |
", version " + jQuery.migrateVersion ); |
|
72 |
||
73 |
} )(); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
74 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
75 |
var warnedAbout = {}; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
76 |
|
18 | 77 |
// By default each warning is only reported once. |
78 |
jQuery.migrateDeduplicateWarnings = true; |
|
79 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
80 |
// List of warnings already given; public read only |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
81 |
jQuery.migrateWarnings = []; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
82 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
83 |
// Set to false to disable traces that appear with warnings |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
84 |
if ( jQuery.migrateTrace === undefined ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
85 |
jQuery.migrateTrace = true; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
86 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
87 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
88 |
// Forget any warnings we've already given; public |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
89 |
jQuery.migrateReset = function() { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
90 |
warnedAbout = {}; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
91 |
jQuery.migrateWarnings.length = 0; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
92 |
}; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
93 |
|
18 | 94 |
function migrateWarn( msg ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
95 |
var console = window.console; |
18 | 96 |
if ( !jQuery.migrateDeduplicateWarnings || !warnedAbout[ msg ] ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
97 |
warnedAbout[ msg ] = true; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
98 |
jQuery.migrateWarnings.push( msg ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
99 |
if ( console && console.warn && !jQuery.migrateMute ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
100 |
console.warn( "JQMIGRATE: " + msg ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
101 |
if ( jQuery.migrateTrace && console.trace ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
102 |
console.trace(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
103 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
104 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
105 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
106 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
107 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
108 |
function migrateWarnProp( obj, prop, value, msg ) { |
18 | 109 |
Object.defineProperty( obj, prop, { |
110 |
configurable: true, |
|
111 |
enumerable: true, |
|
112 |
get: function() { |
|
113 |
migrateWarn( msg ); |
|
114 |
return value; |
|
115 |
}, |
|
116 |
set: function( newValue ) { |
|
117 |
migrateWarn( msg ); |
|
118 |
value = newValue; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
119 |
} |
18 | 120 |
} ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
121 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
122 |
|
18 | 123 |
function migrateWarnFunc( obj, prop, newFunc, msg ) { |
124 |
obj[ prop ] = function() { |
|
125 |
migrateWarn( msg ); |
|
126 |
return newFunc.apply( this, arguments ); |
|
127 |
}; |
|
128 |
} |
|
129 |
||
130 |
if ( window.document.compatMode === "BackCompat" ) { |
|
131 |
||
132 |
// JQuery has never supported or tested Quirks Mode |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
133 |
migrateWarn( "jQuery is not compatible with Quirks Mode" ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
134 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
135 |
|
18 | 136 |
var findProp, |
137 |
class2type = {}, |
|
138 |
oldInit = jQuery.fn.init, |
|
139 |
oldFind = jQuery.find, |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
140 |
|
18 | 141 |
rattrHashTest = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/, |
142 |
rattrHashGlob = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/g, |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
143 |
|
18 | 144 |
// Support: Android <=4.0 only |
145 |
// Make sure we trim BOM and NBSP |
|
146 |
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
147 |
|
18 | 148 |
jQuery.fn.init = function( arg1 ) { |
149 |
var args = Array.prototype.slice.call( arguments ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
150 |
|
18 | 151 |
if ( typeof arg1 === "string" && arg1 === "#" ) { |
152 |
||
153 |
// JQuery( "#" ) is a bogus ID selector, but it returned an empty set before jQuery 3.0 |
|
154 |
migrateWarn( "jQuery( '#' ) is not a valid selector" ); |
|
155 |
args[ 0 ] = []; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
156 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
157 |
|
18 | 158 |
return oldInit.apply( this, args ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
159 |
}; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
160 |
jQuery.fn.init.prototype = jQuery.fn; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
161 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
162 |
jQuery.find = function( selector ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
163 |
var args = Array.prototype.slice.call( arguments ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
164 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
165 |
// Support: PhantomJS 1.x |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
166 |
// String#match fails to match when used with a //g RegExp, only on some strings |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
167 |
if ( typeof selector === "string" && rattrHashTest.test( selector ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
168 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
169 |
// The nonstandard and undocumented unquoted-hash was removed in jQuery 1.12.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
170 |
// First see if qS thinks it's a valid selector, if so avoid a false positive |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
171 |
try { |
18 | 172 |
window.document.querySelector( selector ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
173 |
} catch ( err1 ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
174 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
175 |
// Didn't *look* valid to qSA, warn and try quoting what we think is the value |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
176 |
selector = selector.replace( rattrHashGlob, function( _, attr, op, value ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
177 |
return "[" + attr + op + "\"" + value + "\"]"; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
178 |
} ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
179 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
180 |
// If the regexp *may* have created an invalid selector, don't update it |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
181 |
// Note that there may be false alarms if selector uses jQuery extensions |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
182 |
try { |
18 | 183 |
window.document.querySelector( selector ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
184 |
migrateWarn( "Attribute selector with '#' must be quoted: " + args[ 0 ] ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
185 |
args[ 0 ] = selector; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
186 |
} catch ( err2 ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
187 |
migrateWarn( "Attribute selector with '#' was not fixed: " + args[ 0 ] ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
188 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
189 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
190 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
191 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
192 |
return oldFind.apply( this, args ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
193 |
}; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
194 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
195 |
// Copy properties attached to original jQuery.find method (e.g. .attr, .isXML) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
196 |
for ( findProp in oldFind ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
197 |
if ( Object.prototype.hasOwnProperty.call( oldFind, findProp ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
198 |
jQuery.find[ findProp ] = oldFind[ findProp ]; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
199 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
200 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
201 |
|
18 | 202 |
// The number of elements contained in the matched element set |
203 |
migrateWarnFunc( jQuery.fn, "size", function() { |
|
204 |
return this.length; |
|
205 |
}, |
|
206 |
"jQuery.fn.size() is deprecated and removed; use the .length property" ); |
|
207 |
||
208 |
migrateWarnFunc( jQuery, "parseJSON", function() { |
|
209 |
return JSON.parse.apply( null, arguments ); |
|
210 |
}, |
|
211 |
"jQuery.parseJSON is deprecated; use JSON.parse" ); |
|
212 |
||
213 |
migrateWarnFunc( jQuery, "holdReady", jQuery.holdReady, |
|
214 |
"jQuery.holdReady is deprecated" ); |
|
215 |
||
216 |
migrateWarnFunc( jQuery, "unique", jQuery.uniqueSort, |
|
217 |
"jQuery.unique is deprecated; use jQuery.uniqueSort" ); |
|
218 |
||
219 |
// Now jQuery.expr.pseudos is the standard incantation |
|
220 |
migrateWarnProp( jQuery.expr, "filters", jQuery.expr.pseudos, |
|
221 |
"jQuery.expr.filters is deprecated; use jQuery.expr.pseudos" ); |
|
222 |
migrateWarnProp( jQuery.expr, ":", jQuery.expr.pseudos, |
|
223 |
"jQuery.expr[':'] is deprecated; use jQuery.expr.pseudos" ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
224 |
|
18 | 225 |
// Prior to jQuery 3.1.1 there were internal refs so we don't warn there |
226 |
if ( jQueryVersionSince( "3.1.1" ) ) { |
|
227 |
migrateWarnFunc( jQuery, "trim", function( text ) { |
|
228 |
return text == null ? |
|
229 |
"" : |
|
230 |
( text + "" ).replace( rtrim, "" ); |
|
231 |
}, |
|
232 |
"jQuery.trim is deprecated; use String.prototype.trim" ); |
|
233 |
} |
|
234 |
||
235 |
// Prior to jQuery 3.2 there were internal refs so we don't warn there |
|
236 |
if ( jQueryVersionSince( "3.2.0" ) ) { |
|
237 |
migrateWarnFunc( jQuery, "nodeName", function( elem, name ) { |
|
238 |
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); |
|
239 |
}, |
|
240 |
"jQuery.nodeName is deprecated" ); |
|
241 |
||
242 |
migrateWarnFunc( jQuery, "isArray", Array.isArray, |
|
243 |
"jQuery.isArray is deprecated; use Array.isArray" |
|
244 |
); |
|
245 |
} |
|
246 |
||
247 |
if ( jQueryVersionSince( "3.3.0" ) ) { |
|
248 |
||
249 |
migrateWarnFunc( jQuery, "isNumeric", function( obj ) { |
|
250 |
||
251 |
// As of jQuery 3.0, isNumeric is limited to |
|
252 |
// strings and numbers (primitives or objects) |
|
253 |
// that can be coerced to finite numbers (gh-2662) |
|
254 |
var type = typeof obj; |
|
255 |
return ( type === "number" || type === "string" ) && |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
256 |
|
18 | 257 |
// parseFloat NaNs numeric-cast false positives ("") |
258 |
// ...but misinterprets leading-number strings, e.g. hex literals ("0x...") |
|
259 |
// subtraction forces infinities to NaN |
|
260 |
!isNaN( obj - parseFloat( obj ) ); |
|
261 |
}, |
|
262 |
"jQuery.isNumeric() is deprecated" |
|
263 |
); |
|
264 |
||
265 |
// Populate the class2type map |
|
266 |
jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol". |
|
267 |
split( " " ), |
|
268 |
function( _, name ) { |
|
269 |
class2type[ "[object " + name + "]" ] = name.toLowerCase(); |
|
270 |
} ); |
|
271 |
||
272 |
migrateWarnFunc( jQuery, "type", function( obj ) { |
|
273 |
if ( obj == null ) { |
|
274 |
return obj + ""; |
|
275 |
} |
|
276 |
||
277 |
// Support: Android <=2.3 only (functionish RegExp) |
|
278 |
return typeof obj === "object" || typeof obj === "function" ? |
|
279 |
class2type[ Object.prototype.toString.call( obj ) ] || "object" : |
|
280 |
typeof obj; |
|
281 |
}, |
|
282 |
"jQuery.type is deprecated" ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
283 |
|
18 | 284 |
migrateWarnFunc( jQuery, "isFunction", |
285 |
function( obj ) { |
|
286 |
return typeof obj === "function"; |
|
287 |
}, |
|
288 |
"jQuery.isFunction() is deprecated" ); |
|
289 |
||
290 |
migrateWarnFunc( jQuery, "isWindow", |
|
291 |
function( obj ) { |
|
292 |
return obj != null && obj === obj.window; |
|
293 |
}, |
|
294 |
"jQuery.isWindow() is deprecated" |
|
295 |
); |
|
296 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
297 |
|
18 | 298 |
// Support jQuery slim which excludes the ajax module |
299 |
if ( jQuery.ajax ) { |
|
300 |
||
301 |
var oldAjax = jQuery.ajax, |
|
302 |
rjsonp = /(=)\?(?=&|$)|\?\?/; |
|
303 |
||
304 |
jQuery.ajax = function( ) { |
|
305 |
var jQXHR = oldAjax.apply( this, arguments ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
306 |
|
18 | 307 |
// Be sure we got a jQXHR (e.g., not sync) |
308 |
if ( jQXHR.promise ) { |
|
309 |
migrateWarnFunc( jQXHR, "success", jQXHR.done, |
|
310 |
"jQXHR.success is deprecated and removed" ); |
|
311 |
migrateWarnFunc( jQXHR, "error", jQXHR.fail, |
|
312 |
"jQXHR.error is deprecated and removed" ); |
|
313 |
migrateWarnFunc( jQXHR, "complete", jQXHR.always, |
|
314 |
"jQXHR.complete is deprecated and removed" ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
315 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
316 |
|
18 | 317 |
return jQXHR; |
318 |
}; |
|
319 |
||
320 |
// Only trigger the logic in jQuery <4 as the JSON-to-JSONP auto-promotion |
|
321 |
// behavior is gone in jQuery 4.0 and as it has security implications, we don't |
|
322 |
// want to restore the legacy behavior. |
|
323 |
if ( !jQueryVersionSince( "4.0.0" ) ) { |
|
324 |
||
325 |
// Register this prefilter before the jQuery one. Otherwise, a promoted |
|
326 |
// request is transformed into one with the script dataType and we can't |
|
327 |
// catch it anymore. |
|
328 |
jQuery.ajaxPrefilter( "+json", function( s ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
329 |
|
18 | 330 |
// Warn if JSON-to-JSONP auto-promotion happens. |
331 |
if ( s.jsonp !== false && ( rjsonp.test( s.url ) || |
|
332 |
typeof s.data === "string" && |
|
333 |
( s.contentType || "" ) |
|
334 |
.indexOf( "application/x-www-form-urlencoded" ) === 0 && |
|
335 |
rjsonp.test( s.data ) |
|
336 |
) ) { |
|
337 |
migrateWarn( "JSON-to-JSONP auto-promotion is deprecated" ); |
|
338 |
} |
|
339 |
} ); |
|
340 |
} |
|
341 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
342 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
343 |
|
18 | 344 |
var oldRemoveAttr = jQuery.fn.removeAttr, |
345 |
oldToggleClass = jQuery.fn.toggleClass, |
|
346 |
rmatchNonSpace = /\S+/g; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
347 |
|
18 | 348 |
jQuery.fn.removeAttr = function( name ) { |
349 |
var self = this; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
350 |
|
18 | 351 |
jQuery.each( name.match( rmatchNonSpace ), function( _i, attr ) { |
352 |
if ( jQuery.expr.match.bool.test( attr ) ) { |
|
353 |
migrateWarn( "jQuery.fn.removeAttr no longer sets boolean properties: " + attr ); |
|
354 |
self.prop( attr, false ); |
|
355 |
} |
|
356 |
} ); |
|
357 |
||
358 |
return oldRemoveAttr.apply( this, arguments ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
359 |
}; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
360 |
|
18 | 361 |
jQuery.fn.toggleClass = function( state ) { |
362 |
||
363 |
// Only deprecating no-args or single boolean arg |
|
364 |
if ( state !== undefined && typeof state !== "boolean" ) { |
|
365 |
return oldToggleClass.apply( this, arguments ); |
|
366 |
} |
|
367 |
||
368 |
migrateWarn( "jQuery.fn.toggleClass( boolean ) is deprecated" ); |
|
369 |
||
370 |
// Toggle entire class name of each element |
|
371 |
return this.each( function() { |
|
372 |
var className = this.getAttribute && this.getAttribute( "class" ) || ""; |
|
373 |
||
374 |
if ( className ) { |
|
375 |
jQuery.data( this, "__className__", className ); |
|
376 |
} |
|
377 |
||
378 |
// If the element has a class name or if we're passed `false`, |
|
379 |
// then remove the whole classname (if there was one, the above saved it). |
|
380 |
// Otherwise bring back whatever was previously saved (if anything), |
|
381 |
// falling back to the empty string if nothing was stored. |
|
382 |
if ( this.setAttribute ) { |
|
383 |
this.setAttribute( "class", |
|
384 |
className || state === false ? |
|
385 |
"" : |
|
386 |
jQuery.data( this, "__className__" ) || "" |
|
387 |
); |
|
388 |
} |
|
389 |
} ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
390 |
}; |
18 | 391 |
|
392 |
function camelCase( string ) { |
|
393 |
return string.replace( /-([a-z])/g, function( _, letter ) { |
|
394 |
return letter.toUpperCase(); |
|
395 |
} ); |
|
396 |
} |
|
397 |
||
398 |
var oldFnCss, |
|
399 |
internalSwapCall = false, |
|
400 |
ralphaStart = /^[a-z]/, |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
401 |
|
18 | 402 |
// The regex visualized: |
403 |
// |
|
404 |
// /----------\ |
|
405 |
// | | /-------\ |
|
406 |
// | / Top \ | | | |
|
407 |
// /--- Border ---+-| Right |-+---+- Width -+---\ |
|
408 |
// | | Bottom | | |
|
409 |
// | \ Left / | |
|
410 |
// | | |
|
411 |
// | /----------\ | |
|
412 |
// | /-------------\ | | |- END |
|
413 |
// | | | | / Top \ | | |
|
414 |
// | | / Margin \ | | | Right | | | |
|
415 |
// |---------+-| |-+---+-| Bottom |-+----| |
|
416 |
// | \ Padding / \ Left / | |
|
417 |
// BEGIN -| | |
|
418 |
// | /---------\ | |
|
419 |
// | | | | |
|
420 |
// | | / Min \ | / Width \ | |
|
421 |
// \--------------+-| |-+---| |---/ |
|
422 |
// \ Max / \ Height / |
|
423 |
rautoPx = /^(?:Border(?:Top|Right|Bottom|Left)?(?:Width|)|(?:Margin|Padding)?(?:Top|Right|Bottom|Left)?|(?:Min|Max)?(?:Width|Height))$/; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
424 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
425 |
// If this version of jQuery has .swap(), don't false-alarm on internal uses |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
426 |
if ( jQuery.swap ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
427 |
jQuery.each( [ "height", "width", "reliableMarginRight" ], function( _, name ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
428 |
var oldHook = jQuery.cssHooks[ name ] && jQuery.cssHooks[ name ].get; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
429 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
430 |
if ( oldHook ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
431 |
jQuery.cssHooks[ name ].get = function() { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
432 |
var ret; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
433 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
434 |
internalSwapCall = true; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
435 |
ret = oldHook.apply( this, arguments ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
436 |
internalSwapCall = false; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
437 |
return ret; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
438 |
}; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
439 |
} |
18 | 440 |
} ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
441 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
442 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
443 |
jQuery.swap = function( elem, options, callback, args ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
444 |
var ret, name, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
445 |
old = {}; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
446 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
447 |
if ( !internalSwapCall ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
448 |
migrateWarn( "jQuery.swap() is undocumented and deprecated" ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
449 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
450 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
451 |
// Remember the old values, and insert the new ones |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
452 |
for ( name in options ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
453 |
old[ name ] = elem.style[ name ]; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
454 |
elem.style[ name ] = options[ name ]; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
455 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
456 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
457 |
ret = callback.apply( elem, args || [] ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
458 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
459 |
// Revert the old values |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
460 |
for ( name in options ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
461 |
elem.style[ name ] = old[ name ]; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
462 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
463 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
464 |
return ret; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
465 |
}; |
18 | 466 |
|
467 |
if ( jQueryVersionSince( "3.4.0" ) && typeof Proxy !== "undefined" ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
468 |
|
18 | 469 |
jQuery.cssProps = new Proxy( jQuery.cssProps || {}, { |
470 |
set: function() { |
|
471 |
migrateWarn( "JQMIGRATE: jQuery.cssProps is deprecated" ); |
|
472 |
return Reflect.set.apply( this, arguments ); |
|
473 |
} |
|
474 |
} ); |
|
475 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
476 |
|
18 | 477 |
// Create a dummy jQuery.cssNumber if missing. It won't be used by jQuery but |
478 |
// it will prevent code adding new keys to it unconditionally from crashing. |
|
479 |
if ( !jQuery.cssNumber ) { |
|
480 |
jQuery.cssNumber = {}; |
|
481 |
} |
|
482 |
||
483 |
function isAutoPx( prop ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
484 |
|
18 | 485 |
// The first test is used to ensure that: |
486 |
// 1. The prop starts with a lowercase letter (as we uppercase it for the second regex). |
|
487 |
// 2. The prop is not empty. |
|
488 |
return ralphaStart.test( prop ) && |
|
489 |
rautoPx.test( prop[ 0 ].toUpperCase() + prop.slice( 1 ) ); |
|
490 |
} |
|
491 |
||
492 |
oldFnCss = jQuery.fn.css; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
493 |
|
18 | 494 |
jQuery.fn.css = function( name, value ) { |
495 |
var camelName, |
|
496 |
origThis = this; |
|
497 |
if ( name && typeof name === "object" && !Array.isArray( name ) ) { |
|
498 |
jQuery.each( name, function( n, v ) { |
|
499 |
jQuery.fn.css.call( origThis, n, v ); |
|
500 |
} ); |
|
501 |
return this; |
|
502 |
} |
|
503 |
if ( typeof value === "number" ) { |
|
504 |
camelName = camelCase( name ); |
|
505 |
if ( !isAutoPx( camelName ) && !jQuery.cssNumber[ camelName ] ) { |
|
506 |
migrateWarn( "Number-typed values are deprecated for jQuery.fn.css( \"" + |
|
507 |
name + "\", value )" ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
508 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
509 |
} |
18 | 510 |
|
511 |
return oldFnCss.apply( this, arguments ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
512 |
}; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
513 |
|
18 | 514 |
var oldData = jQuery.data; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
515 |
|
18 | 516 |
jQuery.data = function( elem, name, value ) { |
517 |
var curData, sameKeys, key; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
518 |
|
18 | 519 |
// Name can be an object, and each entry in the object is meant to be set as data |
520 |
if ( name && typeof name === "object" && arguments.length === 2 ) { |
|
521 |
curData = jQuery.hasData( elem ) && oldData.call( this, elem ); |
|
522 |
sameKeys = {}; |
|
523 |
for ( key in name ) { |
|
524 |
if ( key !== camelCase( key ) ) { |
|
525 |
migrateWarn( "jQuery.data() always sets/gets camelCased names: " + key ); |
|
526 |
curData[ key ] = name[ key ]; |
|
527 |
} else { |
|
528 |
sameKeys[ key ] = name[ key ]; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
529 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
530 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
531 |
|
18 | 532 |
oldData.call( this, elem, sameKeys ); |
533 |
||
534 |
return name; |
|
535 |
} |
|
536 |
||
537 |
// If the name is transformed, look for the un-transformed name in the data object |
|
538 |
if ( name && typeof name === "string" && name !== camelCase( name ) ) { |
|
539 |
curData = jQuery.hasData( elem ) && oldData.call( this, elem ); |
|
540 |
if ( curData && name in curData ) { |
|
541 |
migrateWarn( "jQuery.data() always sets/gets camelCased names: " + name ); |
|
542 |
if ( arguments.length > 2 ) { |
|
543 |
curData[ name ] = value; |
|
544 |
} |
|
545 |
return curData[ name ]; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
546 |
} |
18 | 547 |
} |
548 |
||
549 |
return oldData.apply( this, arguments ); |
|
550 |
}; |
|
551 |
||
552 |
// Support jQuery slim which excludes the effects module |
|
553 |
if ( jQuery.fx ) { |
|
554 |
||
555 |
var intervalValue, intervalMsg, |
|
556 |
oldTweenRun = jQuery.Tween.prototype.run, |
|
557 |
linearEasing = function( pct ) { |
|
558 |
return pct; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
559 |
}; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
560 |
|
18 | 561 |
jQuery.Tween.prototype.run = function( ) { |
562 |
if ( jQuery.easing[ this.easing ].length > 1 ) { |
|
563 |
migrateWarn( |
|
564 |
"'jQuery.easing." + this.easing.toString() + "' should use only one argument" |
|
565 |
); |
|
566 |
||
567 |
jQuery.easing[ this.easing ] = linearEasing; |
|
568 |
} |
|
569 |
||
570 |
oldTweenRun.apply( this, arguments ); |
|
571 |
}; |
|
572 |
||
573 |
intervalValue = jQuery.fx.interval || 13; |
|
574 |
intervalMsg = "jQuery.fx.interval is deprecated"; |
|
575 |
||
576 |
// Support: IE9, Android <=4.4 |
|
577 |
// Avoid false positives on browsers that lack rAF |
|
578 |
// Don't warn if document is hidden, jQuery uses setTimeout (#292) |
|
579 |
if ( window.requestAnimationFrame ) { |
|
580 |
Object.defineProperty( jQuery.fx, "interval", { |
|
581 |
configurable: true, |
|
582 |
enumerable: true, |
|
583 |
get: function() { |
|
584 |
if ( !window.document.hidden ) { |
|
585 |
migrateWarn( intervalMsg ); |
|
586 |
} |
|
587 |
return intervalValue; |
|
588 |
}, |
|
589 |
set: function( newValue ) { |
|
590 |
migrateWarn( intervalMsg ); |
|
591 |
intervalValue = newValue; |
|
592 |
} |
|
593 |
} ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
594 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
595 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
596 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
597 |
|
18 | 598 |
var oldLoad = jQuery.fn.load, |
599 |
oldEventAdd = jQuery.event.add, |
|
600 |
originalFix = jQuery.event.fix; |
|
601 |
||
602 |
jQuery.event.props = []; |
|
603 |
jQuery.event.fixHooks = {}; |
|
604 |
||
605 |
migrateWarnProp( jQuery.event.props, "concat", jQuery.event.props.concat, |
|
606 |
"jQuery.event.props.concat() is deprecated and removed" ); |
|
607 |
||
608 |
jQuery.event.fix = function( originalEvent ) { |
|
609 |
var event, |
|
610 |
type = originalEvent.type, |
|
611 |
fixHook = this.fixHooks[ type ], |
|
612 |
props = jQuery.event.props; |
|
613 |
||
614 |
if ( props.length ) { |
|
615 |
migrateWarn( "jQuery.event.props are deprecated and removed: " + props.join() ); |
|
616 |
while ( props.length ) { |
|
617 |
jQuery.event.addProp( props.pop() ); |
|
618 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
619 |
} |
18 | 620 |
|
621 |
if ( fixHook && !fixHook._migrated_ ) { |
|
622 |
fixHook._migrated_ = true; |
|
623 |
migrateWarn( "jQuery.event.fixHooks are deprecated and removed: " + type ); |
|
624 |
if ( ( props = fixHook.props ) && props.length ) { |
|
625 |
while ( props.length ) { |
|
626 |
jQuery.event.addProp( props.pop() ); |
|
627 |
} |
|
628 |
} |
|
629 |
} |
|
630 |
||
631 |
event = originalFix.call( this, originalEvent ); |
|
632 |
||
633 |
return fixHook && fixHook.filter ? fixHook.filter( event, originalEvent ) : event; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
634 |
}; |
18 | 635 |
|
636 |
jQuery.event.add = function( elem, types ) { |
|
637 |
||
638 |
// This misses the multiple-types case but that seems awfully rare |
|
639 |
if ( elem === window && types === "load" && window.document.readyState === "complete" ) { |
|
640 |
migrateWarn( "jQuery(window).on('load'...) called after load event occurred" ); |
|
641 |
} |
|
642 |
return oldEventAdd.apply( this, arguments ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
643 |
}; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
644 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
645 |
jQuery.each( [ "load", "unload", "error" ], function( _, name ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
646 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
647 |
jQuery.fn[ name ] = function() { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
648 |
var args = Array.prototype.slice.call( arguments, 0 ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
649 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
650 |
// If this is an ajax load() the first arg should be the string URL; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
651 |
// technically this could also be the "Anything" arg of the event .load() |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
652 |
// which just goes to show why this dumb signature has been deprecated! |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
653 |
// jQuery custom builds that exclude the Ajax module justifiably die here. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
654 |
if ( name === "load" && typeof args[ 0 ] === "string" ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
655 |
return oldLoad.apply( this, args ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
656 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
657 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
658 |
migrateWarn( "jQuery.fn." + name + "() is deprecated" ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
659 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
660 |
args.splice( 0, 0, name ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
661 |
if ( arguments.length ) { |
18 | 662 |
return this.on.apply( this, args ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
663 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
664 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
665 |
// Use .triggerHandler here because: |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
666 |
// - load and unload events don't need to bubble, only applied to window or image |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
667 |
// - error event should not bubble to window, although it does pre-1.7 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
668 |
// See http://bugs.jquery.com/ticket/11820 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
669 |
this.triggerHandler.apply( this, args ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
670 |
return this; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
671 |
}; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
672 |
|
18 | 673 |
} ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
674 |
|
18 | 675 |
jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " + |
676 |
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + |
|
677 |
"change select submit keydown keypress keyup contextmenu" ).split( " " ), |
|
678 |
function( _i, name ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
679 |
|
18 | 680 |
// Handle event binding |
681 |
jQuery.fn[ name ] = function( data, fn ) { |
|
682 |
migrateWarn( "jQuery.fn." + name + "() event shorthand is deprecated" ); |
|
683 |
return arguments.length > 0 ? |
|
684 |
this.on( name, null, data, fn ) : |
|
685 |
this.trigger( name ); |
|
686 |
}; |
|
687 |
} ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
688 |
|
18 | 689 |
// Trigger "ready" event only once, on document ready |
690 |
jQuery( function() { |
|
691 |
jQuery( window.document ).triggerHandler( "ready" ); |
|
692 |
} ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
693 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
694 |
jQuery.event.special.ready = { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
695 |
setup: function() { |
18 | 696 |
if ( this === window.document ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
697 |
migrateWarn( "'ready' event is deprecated" ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
698 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
699 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
700 |
}; |
18 | 701 |
|
702 |
jQuery.fn.extend( { |
|
703 |
||
704 |
bind: function( types, data, fn ) { |
|
705 |
migrateWarn( "jQuery.fn.bind() is deprecated" ); |
|
706 |
return this.on( types, null, data, fn ); |
|
707 |
}, |
|
708 |
unbind: function( types, fn ) { |
|
709 |
migrateWarn( "jQuery.fn.unbind() is deprecated" ); |
|
710 |
return this.off( types, null, fn ); |
|
711 |
}, |
|
712 |
delegate: function( selector, types, data, fn ) { |
|
713 |
migrateWarn( "jQuery.fn.delegate() is deprecated" ); |
|
714 |
return this.on( types, selector, data, fn ); |
|
715 |
}, |
|
716 |
undelegate: function( selector, types, fn ) { |
|
717 |
migrateWarn( "jQuery.fn.undelegate() is deprecated" ); |
|
718 |
return arguments.length === 1 ? |
|
719 |
this.off( selector, "**" ) : |
|
720 |
this.off( types, selector || "**", fn ); |
|
721 |
}, |
|
722 |
hover: function( fnOver, fnOut ) { |
|
723 |
migrateWarn( "jQuery.fn.hover() is deprecated" ); |
|
724 |
return this.on( "mouseenter", fnOver ).on( "mouseleave", fnOut || fnOver ); |
|
725 |
} |
|
726 |
} ); |
|
727 |
||
728 |
var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi, |
|
729 |
origHtmlPrefilter = jQuery.htmlPrefilter, |
|
730 |
makeMarkup = function( html ) { |
|
731 |
var doc = window.document.implementation.createHTMLDocument( "" ); |
|
732 |
doc.body.innerHTML = html; |
|
733 |
return doc.body && doc.body.innerHTML; |
|
734 |
}, |
|
735 |
warnIfChanged = function( html ) { |
|
736 |
var changed = html.replace( rxhtmlTag, "<$1></$2>" ); |
|
737 |
if ( changed !== html && makeMarkup( html ) !== makeMarkup( changed ) ) { |
|
738 |
migrateWarn( "HTML tags must be properly nested and closed: " + html ); |
|
739 |
} |
|
740 |
}; |
|
741 |
||
742 |
jQuery.UNSAFE_restoreLegacyHtmlPrefilter = function() { |
|
743 |
jQuery.htmlPrefilter = function( html ) { |
|
744 |
warnIfChanged( html ); |
|
745 |
return html.replace( rxhtmlTag, "<$1></$2>" ); |
|
746 |
}; |
|
747 |
}; |
|
748 |
||
749 |
jQuery.htmlPrefilter = function( html ) { |
|
750 |
warnIfChanged( html ); |
|
751 |
return origHtmlPrefilter( html ); |
|
752 |
}; |
|
753 |
||
754 |
var oldOffset = jQuery.fn.offset; |
|
755 |
||
756 |
jQuery.fn.offset = function() { |
|
757 |
var elem = this[ 0 ]; |
|
758 |
||
759 |
if ( elem && ( !elem.nodeType || !elem.getBoundingClientRect ) ) { |
|
760 |
migrateWarn( "jQuery.fn.offset() requires a valid DOM element" ); |
|
761 |
return arguments.length ? this : undefined; |
|
762 |
} |
|
763 |
||
764 |
return oldOffset.apply( this, arguments ); |
|
765 |
}; |
|
766 |
||
767 |
// Support jQuery slim which excludes the ajax module |
|
768 |
// The jQuery.param patch is about respecting `jQuery.ajaxSettings.traditional` |
|
769 |
// so it doesn't make sense for the slim build. |
|
770 |
if ( jQuery.ajax ) { |
|
771 |
||
772 |
var oldParam = jQuery.param; |
|
773 |
||
774 |
jQuery.param = function( data, traditional ) { |
|
775 |
var ajaxTraditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; |
|
776 |
||
777 |
if ( traditional === undefined && ajaxTraditional ) { |
|
778 |
||
779 |
migrateWarn( "jQuery.param() no longer uses jQuery.ajaxSettings.traditional" ); |
|
780 |
traditional = ajaxTraditional; |
|
781 |
} |
|
782 |
||
783 |
return oldParam.call( this, data, traditional ); |
|
784 |
}; |
|
785 |
||
786 |
} |
|
787 |
||
788 |
var oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
789 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
790 |
jQuery.fn.andSelf = function() { |
18 | 791 |
migrateWarn( "jQuery.fn.andSelf() is deprecated and removed, use jQuery.fn.addBack()" ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
792 |
return oldSelf.apply( this, arguments ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
793 |
}; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
794 |
|
18 | 795 |
// Support jQuery slim which excludes the deferred module in jQuery 4.0+ |
796 |
if ( jQuery.Deferred ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
797 |
|
18 | 798 |
var oldDeferred = jQuery.Deferred, |
799 |
tuples = [ |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
800 |
|
18 | 801 |
// Action, add listener, callbacks, .then handlers, final state |
802 |
[ "resolve", "done", jQuery.Callbacks( "once memory" ), |
|
803 |
jQuery.Callbacks( "once memory" ), "resolved" ], |
|
804 |
[ "reject", "fail", jQuery.Callbacks( "once memory" ), |
|
805 |
jQuery.Callbacks( "once memory" ), "rejected" ], |
|
806 |
[ "notify", "progress", jQuery.Callbacks( "memory" ), |
|
807 |
jQuery.Callbacks( "memory" ) ] |
|
808 |
]; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
809 |
|
18 | 810 |
jQuery.Deferred = function( func ) { |
811 |
var deferred = oldDeferred(), |
|
812 |
promise = deferred.promise(); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
813 |
|
18 | 814 |
deferred.pipe = promise.pipe = function( /* fnDone, fnFail, fnProgress */ ) { |
815 |
var fns = arguments; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
816 |
|
18 | 817 |
migrateWarn( "deferred.pipe() is deprecated" ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
818 |
|
18 | 819 |
return jQuery.Deferred( function( newDefer ) { |
820 |
jQuery.each( tuples, function( i, tuple ) { |
|
821 |
var fn = typeof fns[ i ] === "function" && fns[ i ]; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
822 |
|
18 | 823 |
// Deferred.done(function() { bind to newDefer or newDefer.resolve }) |
824 |
// deferred.fail(function() { bind to newDefer or newDefer.reject }) |
|
825 |
// deferred.progress(function() { bind to newDefer or newDefer.notify }) |
|
826 |
deferred[ tuple[ 1 ] ]( function() { |
|
827 |
var returned = fn && fn.apply( this, arguments ); |
|
828 |
if ( returned && typeof returned.promise === "function" ) { |
|
829 |
returned.promise() |
|
830 |
.done( newDefer.resolve ) |
|
831 |
.fail( newDefer.reject ) |
|
832 |
.progress( newDefer.notify ); |
|
833 |
} else { |
|
834 |
newDefer[ tuple[ 0 ] + "With" ]( |
|
835 |
this === promise ? newDefer.promise() : this, |
|
836 |
fn ? [ returned ] : arguments |
|
837 |
); |
|
838 |
} |
|
839 |
} ); |
|
840 |
} ); |
|
841 |
fns = null; |
|
842 |
} ).promise(); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
843 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
844 |
}; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
845 |
|
18 | 846 |
if ( func ) { |
847 |
func.call( deferred, deferred ); |
|
848 |
} |
|
849 |
||
850 |
return deferred; |
|
851 |
}; |
|
852 |
||
853 |
// Preserve handler of uncaught exceptions in promise chains |
|
854 |
jQuery.Deferred.exceptionHook = oldDeferred.exceptionHook; |
|
855 |
||
856 |
} |
|
857 |
||
858 |
return jQuery; |
|
859 |
} ); |