author | Rémi Cardona <remi.cardona@logilab.fr> |
Fri, 18 Sep 2015 11:58:29 +0200 | |
changeset 10707 | 3f4f190f8e35 |
parent 9388 | 4c34a63bd113 |
permissions | -rw-r--r-- |
9388
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
1 |
/*! |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
2 |
* jQuery Migrate - v1.2.1 - 2013-05-08 |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
3 |
* https://github.com/jquery/jquery-migrate |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
4 |
* Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors; Licensed MIT |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
5 |
*/ |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
6 |
(function( jQuery, window, undefined ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
7 |
// See http://bugs.jquery.com/ticket/13335 |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
8 |
// "use strict"; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
9 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
10 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
11 |
var warnedAbout = {}; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
12 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
13 |
// List of warnings already given; public read only |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
14 |
jQuery.migrateWarnings = []; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
15 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
16 |
// Set to true to prevent console output; migrateWarnings still maintained |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
17 |
// jQuery.migrateMute = false; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
18 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
19 |
// Show a message on the console so devs know we're active |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
20 |
if ( !jQuery.migrateMute && window.console && window.console.log ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
21 |
window.console.log("JQMIGRATE: Logging is active"); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
22 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
23 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
24 |
// Set to false to disable traces that appear with warnings |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
25 |
if ( jQuery.migrateTrace === undefined ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
26 |
jQuery.migrateTrace = true; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
27 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
28 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
29 |
// Forget any warnings we've already given; public |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
30 |
jQuery.migrateReset = function() { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
31 |
warnedAbout = {}; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
32 |
jQuery.migrateWarnings.length = 0; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
33 |
}; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
34 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
35 |
function migrateWarn( msg) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
36 |
var console = window.console; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
37 |
if ( !warnedAbout[ msg ] ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
38 |
warnedAbout[ msg ] = true; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
39 |
jQuery.migrateWarnings.push( msg ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
40 |
if ( console && console.warn && !jQuery.migrateMute ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
41 |
console.warn( "JQMIGRATE: " + msg ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
42 |
if ( jQuery.migrateTrace && console.trace ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
43 |
console.trace(); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
44 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
45 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
46 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
47 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
48 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
49 |
function migrateWarnProp( obj, prop, value, msg ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
50 |
if ( Object.defineProperty ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
51 |
// On ES5 browsers (non-oldIE), warn if the code tries to get prop; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
52 |
// allow property to be overwritten in case some other plugin wants it |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
53 |
try { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
54 |
Object.defineProperty( obj, prop, { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
55 |
configurable: true, |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
56 |
enumerable: true, |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
57 |
get: function() { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
58 |
migrateWarn( msg ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
59 |
return value; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
60 |
}, |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
61 |
set: function( newValue ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
62 |
migrateWarn( msg ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
63 |
value = newValue; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
64 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
65 |
}); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
66 |
return; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
67 |
} catch( err ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
68 |
// IE8 is a dope about Object.defineProperty, can't warn there |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
69 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
70 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
71 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
72 |
// Non-ES5 (or broken) browser; just set the property |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
73 |
jQuery._definePropertyBroken = true; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
74 |
obj[ prop ] = value; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
75 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
76 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
77 |
if ( document.compatMode === "BackCompat" ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
78 |
// jQuery has never supported or tested Quirks Mode |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
79 |
migrateWarn( "jQuery is not compatible with Quirks Mode" ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
80 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
81 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
82 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
83 |
var attrFn = jQuery( "<input/>", { size: 1 } ).attr("size") && jQuery.attrFn, |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
84 |
oldAttr = jQuery.attr, |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
85 |
valueAttrGet = jQuery.attrHooks.value && jQuery.attrHooks.value.get || |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
86 |
function() { return null; }, |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
87 |
valueAttrSet = jQuery.attrHooks.value && jQuery.attrHooks.value.set || |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
88 |
function() { return undefined; }, |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
89 |
rnoType = /^(?:input|button)$/i, |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
90 |
rnoAttrNodeType = /^[238]$/, |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
91 |
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
92 |
ruseDefault = /^(?:checked|selected)$/i; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
93 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
94 |
// jQuery.attrFn |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
95 |
migrateWarnProp( jQuery, "attrFn", attrFn || {}, "jQuery.attrFn is deprecated" ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
96 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
97 |
jQuery.attr = function( elem, name, value, pass ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
98 |
var lowerName = name.toLowerCase(), |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
99 |
nType = elem && elem.nodeType; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
100 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
101 |
if ( pass ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
102 |
// Since pass is used internally, we only warn for new jQuery |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
103 |
// versions where there isn't a pass arg in the formal params |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
104 |
if ( oldAttr.length < 4 ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
105 |
migrateWarn("jQuery.fn.attr( props, pass ) is deprecated"); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
106 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
107 |
if ( elem && !rnoAttrNodeType.test( nType ) && |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
108 |
(attrFn ? name in attrFn : jQuery.isFunction(jQuery.fn[name])) ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
109 |
return jQuery( elem )[ name ]( value ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
110 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
111 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
112 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
113 |
// Warn if user tries to set `type`, since it breaks on IE 6/7/8; by checking |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
114 |
// for disconnected elements we don't warn on $( "<button>", { type: "button" } ). |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
115 |
if ( name === "type" && value !== undefined && rnoType.test( elem.nodeName ) && elem.parentNode ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
116 |
migrateWarn("Can't change the 'type' of an input or button in IE 6/7/8"); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
117 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
118 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
119 |
// Restore boolHook for boolean property/attribute synchronization |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
120 |
if ( !jQuery.attrHooks[ lowerName ] && rboolean.test( lowerName ) ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
121 |
jQuery.attrHooks[ lowerName ] = { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
122 |
get: function( elem, name ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
123 |
// Align boolean attributes with corresponding properties |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
124 |
// Fall back to attribute presence where some booleans are not supported |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
125 |
var attrNode, |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
126 |
property = jQuery.prop( elem, name ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
127 |
return property === true || typeof property !== "boolean" && |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
128 |
( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
129 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
130 |
name.toLowerCase() : |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
131 |
undefined; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
132 |
}, |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
133 |
set: function( elem, value, name ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
134 |
var propName; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
135 |
if ( value === false ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
136 |
// Remove boolean attributes when set to false |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
137 |
jQuery.removeAttr( elem, name ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
138 |
} else { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
139 |
// value is true since we know at this point it's type boolean and not false |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
140 |
// Set boolean attributes to the same name and set the DOM property |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
141 |
propName = jQuery.propFix[ name ] || name; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
142 |
if ( propName in elem ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
143 |
// Only set the IDL specifically if it already exists on the element |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
144 |
elem[ propName ] = true; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
145 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
146 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
147 |
elem.setAttribute( name, name.toLowerCase() ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
148 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
149 |
return name; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
150 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
151 |
}; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
152 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
153 |
// Warn only for attributes that can remain distinct from their properties post-1.9 |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
154 |
if ( ruseDefault.test( lowerName ) ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
155 |
migrateWarn( "jQuery.fn.attr('" + lowerName + "') may use property instead of attribute" ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
156 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
157 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
158 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
159 |
return oldAttr.call( jQuery, elem, name, value ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
160 |
}; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
161 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
162 |
// attrHooks: value |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
163 |
jQuery.attrHooks.value = { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
164 |
get: function( elem, name ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
165 |
var nodeName = ( elem.nodeName || "" ).toLowerCase(); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
166 |
if ( nodeName === "button" ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
167 |
return valueAttrGet.apply( this, arguments ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
168 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
169 |
if ( nodeName !== "input" && nodeName !== "option" ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
170 |
migrateWarn("jQuery.fn.attr('value') no longer gets properties"); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
171 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
172 |
return name in elem ? |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
173 |
elem.value : |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
174 |
null; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
175 |
}, |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
176 |
set: function( elem, value ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
177 |
var nodeName = ( elem.nodeName || "" ).toLowerCase(); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
178 |
if ( nodeName === "button" ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
179 |
return valueAttrSet.apply( this, arguments ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
180 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
181 |
if ( nodeName !== "input" && nodeName !== "option" ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
182 |
migrateWarn("jQuery.fn.attr('value', val) no longer sets properties"); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
183 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
184 |
// Does not return so that setAttribute is also used |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
185 |
elem.value = value; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
186 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
187 |
}; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
188 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
189 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
190 |
var matched, browser, |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
191 |
oldInit = jQuery.fn.init, |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
192 |
oldParseJSON = jQuery.parseJSON, |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
193 |
// Note: XSS check is done below after string is trimmed |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
194 |
rquickExpr = /^([^<]*)(<[\w\W]+>)([^>]*)$/; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
195 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
196 |
// $(html) "looks like html" rule change |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
197 |
jQuery.fn.init = function( selector, context, rootjQuery ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
198 |
var match; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
199 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
200 |
if ( selector && typeof selector === "string" && !jQuery.isPlainObject( context ) && |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
201 |
(match = rquickExpr.exec( jQuery.trim( selector ) )) && match[ 0 ] ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
202 |
// This is an HTML string according to the "old" rules; is it still? |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
203 |
if ( selector.charAt( 0 ) !== "<" ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
204 |
migrateWarn("$(html) HTML strings must start with '<' character"); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
205 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
206 |
if ( match[ 3 ] ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
207 |
migrateWarn("$(html) HTML text after last tag is ignored"); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
208 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
209 |
// Consistently reject any HTML-like string starting with a hash (#9521) |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
210 |
// Note that this may break jQuery 1.6.x code that otherwise would work. |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
211 |
if ( match[ 0 ].charAt( 0 ) === "#" ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
212 |
migrateWarn("HTML string cannot start with a '#' character"); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
213 |
jQuery.error("JQMIGRATE: Invalid selector string (XSS)"); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
214 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
215 |
// Now process using loose rules; let pre-1.8 play too |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
216 |
if ( context && context.context ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
217 |
// jQuery object as context; parseHTML expects a DOM object |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
218 |
context = context.context; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
219 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
220 |
if ( jQuery.parseHTML ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
221 |
return oldInit.call( this, jQuery.parseHTML( match[ 2 ], context, true ), |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
222 |
context, rootjQuery ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
223 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
224 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
225 |
return oldInit.apply( this, arguments ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
226 |
}; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
227 |
jQuery.fn.init.prototype = jQuery.fn; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
228 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
229 |
// Let $.parseJSON(falsy_value) return null |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
230 |
jQuery.parseJSON = function( json ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
231 |
if ( !json && json !== null ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
232 |
migrateWarn("jQuery.parseJSON requires a valid JSON string"); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
233 |
return null; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
234 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
235 |
return oldParseJSON.apply( this, arguments ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
236 |
}; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
237 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
238 |
jQuery.uaMatch = function( ua ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
239 |
ua = ua.toLowerCase(); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
240 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
241 |
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) || |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
242 |
/(webkit)[ \/]([\w.]+)/.exec( ua ) || |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
243 |
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) || |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
244 |
/(msie) ([\w.]+)/.exec( ua ) || |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
245 |
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) || |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
246 |
[]; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
247 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
248 |
return { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
249 |
browser: match[ 1 ] || "", |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
250 |
version: match[ 2 ] || "0" |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
251 |
}; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
252 |
}; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
253 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
254 |
// Don't clobber any existing jQuery.browser in case it's different |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
255 |
if ( !jQuery.browser ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
256 |
matched = jQuery.uaMatch( navigator.userAgent ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
257 |
browser = {}; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
258 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
259 |
if ( matched.browser ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
260 |
browser[ matched.browser ] = true; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
261 |
browser.version = matched.version; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
262 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
263 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
264 |
// Chrome is Webkit, but Webkit is also Safari. |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
265 |
if ( browser.chrome ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
266 |
browser.webkit = true; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
267 |
} else if ( browser.webkit ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
268 |
browser.safari = true; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
269 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
270 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
271 |
jQuery.browser = browser; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
272 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
273 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
274 |
// Warn if the code tries to get jQuery.browser |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
275 |
migrateWarnProp( jQuery, "browser", jQuery.browser, "jQuery.browser is deprecated" ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
276 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
277 |
jQuery.sub = function() { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
278 |
function jQuerySub( selector, context ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
279 |
return new jQuerySub.fn.init( selector, context ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
280 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
281 |
jQuery.extend( true, jQuerySub, this ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
282 |
jQuerySub.superclass = this; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
283 |
jQuerySub.fn = jQuerySub.prototype = this(); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
284 |
jQuerySub.fn.constructor = jQuerySub; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
285 |
jQuerySub.sub = this.sub; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
286 |
jQuerySub.fn.init = function init( selector, context ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
287 |
if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
288 |
context = jQuerySub( context ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
289 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
290 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
291 |
return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
292 |
}; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
293 |
jQuerySub.fn.init.prototype = jQuerySub.fn; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
294 |
var rootjQuerySub = jQuerySub(document); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
295 |
migrateWarn( "jQuery.sub() is deprecated" ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
296 |
return jQuerySub; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
297 |
}; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
298 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
299 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
300 |
// Ensure that $.ajax gets the new parseJSON defined in core.js |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
301 |
jQuery.ajaxSetup({ |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
302 |
converters: { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
303 |
"text json": jQuery.parseJSON |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
304 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
305 |
}); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
306 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
307 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
308 |
var oldFnData = jQuery.fn.data; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
309 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
310 |
jQuery.fn.data = function( name ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
311 |
var ret, evt, |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
312 |
elem = this[0]; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
313 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
314 |
// Handles 1.7 which has this behavior and 1.8 which doesn't |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
315 |
if ( elem && name === "events" && arguments.length === 1 ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
316 |
ret = jQuery.data( elem, name ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
317 |
evt = jQuery._data( elem, name ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
318 |
if ( ( ret === undefined || ret === evt ) && evt !== undefined ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
319 |
migrateWarn("Use of jQuery.fn.data('events') is deprecated"); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
320 |
return evt; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
321 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
322 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
323 |
return oldFnData.apply( this, arguments ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
324 |
}; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
325 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
326 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
327 |
var rscriptType = /\/(java|ecma)script/i, |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
328 |
oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
329 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
330 |
jQuery.fn.andSelf = function() { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
331 |
migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()"); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
332 |
return oldSelf.apply( this, arguments ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
333 |
}; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
334 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
335 |
// Since jQuery.clean is used internally on older versions, we only shim if it's missing |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
336 |
if ( !jQuery.clean ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
337 |
jQuery.clean = function( elems, context, fragment, scripts ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
338 |
// Set context per 1.8 logic |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
339 |
context = context || document; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
340 |
context = !context.nodeType && context[0] || context; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
341 |
context = context.ownerDocument || context; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
342 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
343 |
migrateWarn("jQuery.clean() is deprecated"); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
344 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
345 |
var i, elem, handleScript, jsTags, |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
346 |
ret = []; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
347 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
348 |
jQuery.merge( ret, jQuery.buildFragment( elems, context ).childNodes ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
349 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
350 |
// Complex logic lifted directly from jQuery 1.8 |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
351 |
if ( fragment ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
352 |
// Special handling of each script element |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
353 |
handleScript = function( elem ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
354 |
// Check if we consider it executable |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
355 |
if ( !elem.type || rscriptType.test( elem.type ) ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
356 |
// Detach the script and store it in the scripts array (if provided) or the fragment |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
357 |
// Return truthy to indicate that it has been handled |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
358 |
return scripts ? |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
359 |
scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) : |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
360 |
fragment.appendChild( elem ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
361 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
362 |
}; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
363 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
364 |
for ( i = 0; (elem = ret[i]) != null; i++ ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
365 |
// Check if we're done after handling an executable script |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
366 |
if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
367 |
// Append to fragment and handle embedded scripts |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
368 |
fragment.appendChild( elem ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
369 |
if ( typeof elem.getElementsByTagName !== "undefined" ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
370 |
// handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
371 |
jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
372 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
373 |
// Splice the scripts into ret after their former ancestor and advance our index beyond them |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
374 |
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
375 |
i += jsTags.length; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
376 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
377 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
378 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
379 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
380 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
381 |
return ret; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
382 |
}; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
383 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
384 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
385 |
var eventAdd = jQuery.event.add, |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
386 |
eventRemove = jQuery.event.remove, |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
387 |
eventTrigger = jQuery.event.trigger, |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
388 |
oldToggle = jQuery.fn.toggle, |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
389 |
oldLive = jQuery.fn.live, |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
390 |
oldDie = jQuery.fn.die, |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
391 |
ajaxEvents = "ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess", |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
392 |
rajaxEvent = new RegExp( "\\b(?:" + ajaxEvents + ")\\b" ), |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
393 |
rhoverHack = /(?:^|\s)hover(\.\S+|)\b/, |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
394 |
hoverHack = function( events ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
395 |
if ( typeof( events ) !== "string" || jQuery.event.special.hover ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
396 |
return events; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
397 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
398 |
if ( rhoverHack.test( events ) ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
399 |
migrateWarn("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'"); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
400 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
401 |
return events && events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
402 |
}; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
403 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
404 |
// Event props removed in 1.9, put them back if needed; no practical way to warn them |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
405 |
if ( jQuery.event.props && jQuery.event.props[ 0 ] !== "attrChange" ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
406 |
jQuery.event.props.unshift( "attrChange", "attrName", "relatedNode", "srcElement" ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
407 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
408 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
409 |
// Undocumented jQuery.event.handle was "deprecated" in jQuery 1.7 |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
410 |
if ( jQuery.event.dispatch ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
411 |
migrateWarnProp( jQuery.event, "handle", jQuery.event.dispatch, "jQuery.event.handle is undocumented and deprecated" ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
412 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
413 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
414 |
// Support for 'hover' pseudo-event and ajax event warnings |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
415 |
jQuery.event.add = function( elem, types, handler, data, selector ){ |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
416 |
if ( elem !== document && rajaxEvent.test( types ) ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
417 |
migrateWarn( "AJAX events should be attached to document: " + types ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
418 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
419 |
eventAdd.call( this, elem, hoverHack( types || "" ), handler, data, selector ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
420 |
}; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
421 |
jQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){ |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
422 |
eventRemove.call( this, elem, hoverHack( types ) || "", handler, selector, mappedTypes ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
423 |
}; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
424 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
425 |
jQuery.fn.error = function() { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
426 |
var args = Array.prototype.slice.call( arguments, 0); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
427 |
migrateWarn("jQuery.fn.error() is deprecated"); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
428 |
args.splice( 0, 0, "error" ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
429 |
if ( arguments.length ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
430 |
return this.bind.apply( this, args ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
431 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
432 |
// error event should not bubble to window, although it does pre-1.7 |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
433 |
this.triggerHandler.apply( this, args ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
434 |
return this; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
435 |
}; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
436 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
437 |
jQuery.fn.toggle = function( fn, fn2 ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
438 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
439 |
// Don't mess with animation or css toggles |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
440 |
if ( !jQuery.isFunction( fn ) || !jQuery.isFunction( fn2 ) ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
441 |
return oldToggle.apply( this, arguments ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
442 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
443 |
migrateWarn("jQuery.fn.toggle(handler, handler...) is deprecated"); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
444 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
445 |
// Save reference to arguments for access in closure |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
446 |
var args = arguments, |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
447 |
guid = fn.guid || jQuery.guid++, |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
448 |
i = 0, |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
449 |
toggler = function( event ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
450 |
// Figure out which function to execute |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
451 |
var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
452 |
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
453 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
454 |
// Make sure that clicks stop |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
455 |
event.preventDefault(); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
456 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
457 |
// and execute the function |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
458 |
return args[ lastToggle ].apply( this, arguments ) || false; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
459 |
}; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
460 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
461 |
// link all the functions, so any of them can unbind this click handler |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
462 |
toggler.guid = guid; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
463 |
while ( i < args.length ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
464 |
args[ i++ ].guid = guid; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
465 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
466 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
467 |
return this.click( toggler ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
468 |
}; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
469 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
470 |
jQuery.fn.live = function( types, data, fn ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
471 |
migrateWarn("jQuery.fn.live() is deprecated"); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
472 |
if ( oldLive ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
473 |
return oldLive.apply( this, arguments ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
474 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
475 |
jQuery( this.context ).on( types, this.selector, data, fn ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
476 |
return this; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
477 |
}; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
478 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
479 |
jQuery.fn.die = function( types, fn ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
480 |
migrateWarn("jQuery.fn.die() is deprecated"); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
481 |
if ( oldDie ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
482 |
return oldDie.apply( this, arguments ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
483 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
484 |
jQuery( this.context ).off( types, this.selector || "**", fn ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
485 |
return this; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
486 |
}; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
487 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
488 |
// Turn global events into document-triggered events |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
489 |
jQuery.event.trigger = function( event, data, elem, onlyHandlers ){ |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
490 |
if ( !elem && !rajaxEvent.test( event ) ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
491 |
migrateWarn( "Global events are undocumented and deprecated" ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
492 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
493 |
return eventTrigger.call( this, event, data, elem || document, onlyHandlers ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
494 |
}; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
495 |
jQuery.each( ajaxEvents.split("|"), |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
496 |
function( _, name ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
497 |
jQuery.event.special[ name ] = { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
498 |
setup: function() { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
499 |
var elem = this; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
500 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
501 |
// The document needs no shimming; must be !== for oldIE |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
502 |
if ( elem !== document ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
503 |
jQuery.event.add( document, name + "." + jQuery.guid, function() { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
504 |
jQuery.event.trigger( name, null, elem, true ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
505 |
}); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
506 |
jQuery._data( this, name, jQuery.guid++ ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
507 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
508 |
return false; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
509 |
}, |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
510 |
teardown: function() { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
511 |
if ( this !== document ) { |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
512 |
jQuery.event.remove( document, name + "." + jQuery._data( this, name ) ); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
513 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
514 |
return false; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
515 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
516 |
}; |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
517 |
} |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
518 |
); |
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
519 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
520 |
|
4c34a63bd113
update jquery to 1.10 (closes #2786674)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
521 |
})( jQuery, window ); |