govuk_publishing_components 18.1.1 → 18.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/_share-links.scss +11 -5
- data/app/views/govuk_publishing_components/components/docs/share_links.yml +10 -7
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/jquery/AUTHORS.txt +266 -0
- data/node_modules/jquery/LICENSE.txt +36 -0
- data/node_modules/jquery/README.md +65 -0
- data/node_modules/jquery/bower.json +14 -0
- data/node_modules/jquery/dist/jquery.js +11008 -0
- data/node_modules/jquery/dist/jquery.min.js +5 -0
- data/node_modules/jquery/dist/jquery.min.map +1 -0
- data/node_modules/jquery/external/sizzle/LICENSE.txt +36 -0
- data/node_modules/jquery/external/sizzle/dist/sizzle.js +2143 -0
- data/node_modules/jquery/external/sizzle/dist/sizzle.min.js +3 -0
- data/node_modules/jquery/external/sizzle/dist/sizzle.min.map +1 -0
- data/node_modules/jquery/package.json +157 -0
- data/node_modules/jquery/src/ajax.js +842 -0
- data/node_modules/jquery/src/ajax/jsonp.js +100 -0
- data/node_modules/jquery/src/ajax/load.js +83 -0
- data/node_modules/jquery/src/ajax/parseJSON.js +53 -0
- data/node_modules/jquery/src/ajax/parseXML.js +31 -0
- data/node_modules/jquery/src/ajax/script.js +95 -0
- data/node_modules/jquery/src/ajax/var/location.js +3 -0
- data/node_modules/jquery/src/ajax/var/nonce.js +5 -0
- data/node_modules/jquery/src/ajax/var/rquery.js +3 -0
- data/node_modules/jquery/src/ajax/xhr.js +229 -0
- data/node_modules/jquery/src/attributes.js +11 -0
- data/node_modules/jquery/src/attributes/attr.js +281 -0
- data/node_modules/jquery/src/attributes/classes.js +174 -0
- data/node_modules/jquery/src/attributes/prop.js +156 -0
- data/node_modules/jquery/src/attributes/support.js +70 -0
- data/node_modules/jquery/src/attributes/val.js +191 -0
- data/node_modules/jquery/src/callbacks.js +232 -0
- data/node_modules/jquery/src/core.js +529 -0
- data/node_modules/jquery/src/core/access.js +65 -0
- data/node_modules/jquery/src/core/init.js +140 -0
- data/node_modules/jquery/src/core/parseHTML.js +41 -0
- data/node_modules/jquery/src/core/ready.js +163 -0
- data/node_modules/jquery/src/core/var/rsingleTag.js +5 -0
- data/node_modules/jquery/src/css.js +563 -0
- data/node_modules/jquery/src/css/addGetHookIf.js +24 -0
- data/node_modules/jquery/src/css/adjustCSS.js +65 -0
- data/node_modules/jquery/src/css/curCSS.js +137 -0
- data/node_modules/jquery/src/css/defaultDisplay.js +72 -0
- data/node_modules/jquery/src/css/hiddenVisibleSelectors.js +42 -0
- data/node_modules/jquery/src/css/showHide.js +45 -0
- data/node_modules/jquery/src/css/support.js +184 -0
- data/node_modules/jquery/src/css/var/cssExpand.js +3 -0
- data/node_modules/jquery/src/css/var/isHidden.js +16 -0
- data/node_modules/jquery/src/css/var/rmargin.js +3 -0
- data/node_modules/jquery/src/css/var/rnumnonpx.js +5 -0
- data/node_modules/jquery/src/css/var/swap.js +24 -0
- data/node_modules/jquery/src/data.js +342 -0
- data/node_modules/jquery/src/data/support.js +23 -0
- data/node_modules/jquery/src/data/var/acceptData.js +20 -0
- data/node_modules/jquery/src/deferred.js +159 -0
- data/node_modules/jquery/src/deprecated.js +34 -0
- data/node_modules/jquery/src/dimensions.js +56 -0
- data/node_modules/jquery/src/effects.js +640 -0
- data/node_modules/jquery/src/effects/Tween.js +121 -0
- data/node_modules/jquery/src/effects/animatedSelector.js +13 -0
- data/node_modules/jquery/src/effects/support.js +58 -0
- data/node_modules/jquery/src/event.js +1134 -0
- data/node_modules/jquery/src/event/ajax.js +20 -0
- data/node_modules/jquery/src/event/alias.js +25 -0
- data/node_modules/jquery/src/event/support.js +28 -0
- data/node_modules/jquery/src/exports/amd.js +24 -0
- data/node_modules/jquery/src/exports/global.js +26 -0
- data/node_modules/jquery/src/intro.js +44 -0
- data/node_modules/jquery/src/jquery.js +37 -0
- data/node_modules/jquery/src/manipulation.js +585 -0
- data/node_modules/jquery/src/manipulation/_evalUrl.js +21 -0
- data/node_modules/jquery/src/manipulation/buildFragment.js +157 -0
- data/node_modules/jquery/src/manipulation/createSafeFragment.js +20 -0
- data/node_modules/jquery/src/manipulation/getAll.js +33 -0
- data/node_modules/jquery/src/manipulation/setGlobalEval.js +19 -0
- data/node_modules/jquery/src/manipulation/support.js +72 -0
- data/node_modules/jquery/src/manipulation/var/nodeNames.js +5 -0
- data/node_modules/jquery/src/manipulation/var/rcheckableType.js +3 -0
- data/node_modules/jquery/src/manipulation/var/rleadingWhitespace.js +3 -0
- data/node_modules/jquery/src/manipulation/var/rscriptType.js +3 -0
- data/node_modules/jquery/src/manipulation/var/rtagName.js +3 -0
- data/node_modules/jquery/src/manipulation/wrapMap.js +30 -0
- data/node_modules/jquery/src/offset.js +219 -0
- data/node_modules/jquery/src/outro.js +2 -0
- data/node_modules/jquery/src/queue.js +144 -0
- data/node_modules/jquery/src/queue/delay.js +22 -0
- data/node_modules/jquery/src/selector-sizzle.js +14 -0
- data/node_modules/jquery/src/selector.js +1 -0
- data/node_modules/jquery/src/serialize.js +125 -0
- data/node_modules/jquery/src/support.js +63 -0
- data/node_modules/jquery/src/traversing.js +179 -0
- data/node_modules/jquery/src/traversing/findFilter.js +100 -0
- data/node_modules/jquery/src/traversing/var/dir.js +20 -0
- data/node_modules/jquery/src/traversing/var/rneedsContext.js +6 -0
- data/node_modules/jquery/src/traversing/var/siblings.js +15 -0
- data/node_modules/jquery/src/var/class2type.js +5 -0
- data/node_modules/jquery/src/var/concat.js +5 -0
- data/node_modules/jquery/src/var/deletedIds.js +3 -0
- data/node_modules/jquery/src/var/document.js +3 -0
- data/node_modules/jquery/src/var/documentElement.js +5 -0
- data/node_modules/jquery/src/var/hasOwn.js +5 -0
- data/node_modules/jquery/src/var/indexOf.js +5 -0
- data/node_modules/jquery/src/var/pnum.js +3 -0
- data/node_modules/jquery/src/var/push.js +5 -0
- data/node_modules/jquery/src/var/rcssNum.js +7 -0
- data/node_modules/jquery/src/var/rnotwhite.js +3 -0
- data/node_modules/jquery/src/var/slice.js +5 -0
- data/node_modules/jquery/src/var/support.js +5 -0
- data/node_modules/jquery/src/var/toString.js +5 -0
- data/node_modules/jquery/src/wrap.js +77 -0
- metadata +109 -2
@@ -0,0 +1,121 @@
|
|
1
|
+
define( [
|
2
|
+
"../core",
|
3
|
+
"../css"
|
4
|
+
], function( jQuery ) {
|
5
|
+
|
6
|
+
function Tween( elem, options, prop, end, easing ) {
|
7
|
+
return new Tween.prototype.init( elem, options, prop, end, easing );
|
8
|
+
}
|
9
|
+
jQuery.Tween = Tween;
|
10
|
+
|
11
|
+
Tween.prototype = {
|
12
|
+
constructor: Tween,
|
13
|
+
init: function( elem, options, prop, end, easing, unit ) {
|
14
|
+
this.elem = elem;
|
15
|
+
this.prop = prop;
|
16
|
+
this.easing = easing || jQuery.easing._default;
|
17
|
+
this.options = options;
|
18
|
+
this.start = this.now = this.cur();
|
19
|
+
this.end = end;
|
20
|
+
this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
|
21
|
+
},
|
22
|
+
cur: function() {
|
23
|
+
var hooks = Tween.propHooks[ this.prop ];
|
24
|
+
|
25
|
+
return hooks && hooks.get ?
|
26
|
+
hooks.get( this ) :
|
27
|
+
Tween.propHooks._default.get( this );
|
28
|
+
},
|
29
|
+
run: function( percent ) {
|
30
|
+
var eased,
|
31
|
+
hooks = Tween.propHooks[ this.prop ];
|
32
|
+
|
33
|
+
if ( this.options.duration ) {
|
34
|
+
this.pos = eased = jQuery.easing[ this.easing ](
|
35
|
+
percent, this.options.duration * percent, 0, 1, this.options.duration
|
36
|
+
);
|
37
|
+
} else {
|
38
|
+
this.pos = eased = percent;
|
39
|
+
}
|
40
|
+
this.now = ( this.end - this.start ) * eased + this.start;
|
41
|
+
|
42
|
+
if ( this.options.step ) {
|
43
|
+
this.options.step.call( this.elem, this.now, this );
|
44
|
+
}
|
45
|
+
|
46
|
+
if ( hooks && hooks.set ) {
|
47
|
+
hooks.set( this );
|
48
|
+
} else {
|
49
|
+
Tween.propHooks._default.set( this );
|
50
|
+
}
|
51
|
+
return this;
|
52
|
+
}
|
53
|
+
};
|
54
|
+
|
55
|
+
Tween.prototype.init.prototype = Tween.prototype;
|
56
|
+
|
57
|
+
Tween.propHooks = {
|
58
|
+
_default: {
|
59
|
+
get: function( tween ) {
|
60
|
+
var result;
|
61
|
+
|
62
|
+
// Use a property on the element directly when it is not a DOM element,
|
63
|
+
// or when there is no matching style property that exists.
|
64
|
+
if ( tween.elem.nodeType !== 1 ||
|
65
|
+
tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
|
66
|
+
return tween.elem[ tween.prop ];
|
67
|
+
}
|
68
|
+
|
69
|
+
// passing an empty string as a 3rd parameter to .css will automatically
|
70
|
+
// attempt a parseFloat and fallback to a string if the parse fails
|
71
|
+
// so, simple values such as "10px" are parsed to Float.
|
72
|
+
// complex values such as "rotate(1rad)" are returned as is.
|
73
|
+
result = jQuery.css( tween.elem, tween.prop, "" );
|
74
|
+
|
75
|
+
// Empty strings, null, undefined and "auto" are converted to 0.
|
76
|
+
return !result || result === "auto" ? 0 : result;
|
77
|
+
},
|
78
|
+
set: function( tween ) {
|
79
|
+
|
80
|
+
// use step hook for back compat - use cssHook if its there - use .style if its
|
81
|
+
// available and use plain properties where available
|
82
|
+
if ( jQuery.fx.step[ tween.prop ] ) {
|
83
|
+
jQuery.fx.step[ tween.prop ]( tween );
|
84
|
+
} else if ( tween.elem.nodeType === 1 &&
|
85
|
+
( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
|
86
|
+
jQuery.cssHooks[ tween.prop ] ) ) {
|
87
|
+
jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
|
88
|
+
} else {
|
89
|
+
tween.elem[ tween.prop ] = tween.now;
|
90
|
+
}
|
91
|
+
}
|
92
|
+
}
|
93
|
+
};
|
94
|
+
|
95
|
+
// Support: IE <=9
|
96
|
+
// Panic based approach to setting things on disconnected nodes
|
97
|
+
|
98
|
+
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
|
99
|
+
set: function( tween ) {
|
100
|
+
if ( tween.elem.nodeType && tween.elem.parentNode ) {
|
101
|
+
tween.elem[ tween.prop ] = tween.now;
|
102
|
+
}
|
103
|
+
}
|
104
|
+
};
|
105
|
+
|
106
|
+
jQuery.easing = {
|
107
|
+
linear: function( p ) {
|
108
|
+
return p;
|
109
|
+
},
|
110
|
+
swing: function( p ) {
|
111
|
+
return 0.5 - Math.cos( p * Math.PI ) / 2;
|
112
|
+
},
|
113
|
+
_default: "swing"
|
114
|
+
};
|
115
|
+
|
116
|
+
jQuery.fx = Tween.prototype.init;
|
117
|
+
|
118
|
+
// Back Compat <1.8 extension point
|
119
|
+
jQuery.fx.step = {};
|
120
|
+
|
121
|
+
} );
|
@@ -0,0 +1,58 @@
|
|
1
|
+
define( [
|
2
|
+
"../var/support",
|
3
|
+
"../var/document"
|
4
|
+
], function( support, document ) {
|
5
|
+
|
6
|
+
( function() {
|
7
|
+
var shrinkWrapBlocksVal;
|
8
|
+
|
9
|
+
support.shrinkWrapBlocks = function() {
|
10
|
+
if ( shrinkWrapBlocksVal != null ) {
|
11
|
+
return shrinkWrapBlocksVal;
|
12
|
+
}
|
13
|
+
|
14
|
+
// Will be changed later if needed.
|
15
|
+
shrinkWrapBlocksVal = false;
|
16
|
+
|
17
|
+
// Minified: var b,c,d
|
18
|
+
var div, body, container;
|
19
|
+
|
20
|
+
body = document.getElementsByTagName( "body" )[ 0 ];
|
21
|
+
if ( !body || !body.style ) {
|
22
|
+
|
23
|
+
// Test fired too early or in an unsupported environment, exit.
|
24
|
+
return;
|
25
|
+
}
|
26
|
+
|
27
|
+
// Setup
|
28
|
+
div = document.createElement( "div" );
|
29
|
+
container = document.createElement( "div" );
|
30
|
+
container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
|
31
|
+
body.appendChild( container ).appendChild( div );
|
32
|
+
|
33
|
+
// Support: IE6
|
34
|
+
// Check if elements with layout shrink-wrap their children
|
35
|
+
if ( typeof div.style.zoom !== "undefined" ) {
|
36
|
+
|
37
|
+
// Reset CSS: box-sizing; display; margin; border
|
38
|
+
div.style.cssText =
|
39
|
+
|
40
|
+
// Support: Firefox<29, Android 2.3
|
41
|
+
// Vendor-prefix box-sizing
|
42
|
+
"-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
|
43
|
+
"box-sizing:content-box;display:block;margin:0;border:0;" +
|
44
|
+
"padding:1px;width:1px;zoom:1";
|
45
|
+
div.appendChild( document.createElement( "div" ) ).style.width = "5px";
|
46
|
+
shrinkWrapBlocksVal = div.offsetWidth !== 3;
|
47
|
+
}
|
48
|
+
|
49
|
+
body.removeChild( container );
|
50
|
+
|
51
|
+
return shrinkWrapBlocksVal;
|
52
|
+
};
|
53
|
+
|
54
|
+
} )();
|
55
|
+
|
56
|
+
return support;
|
57
|
+
|
58
|
+
} );
|
@@ -0,0 +1,1134 @@
|
|
1
|
+
define( [
|
2
|
+
"./core",
|
3
|
+
"./var/document",
|
4
|
+
"./var/rnotwhite",
|
5
|
+
"./var/hasOwn",
|
6
|
+
"./var/slice",
|
7
|
+
"./event/support",
|
8
|
+
"./data/var/acceptData",
|
9
|
+
|
10
|
+
"./core/init",
|
11
|
+
"./data",
|
12
|
+
"./selector"
|
13
|
+
], function( jQuery, document, rnotwhite, hasOwn, slice, support, acceptData ) {
|
14
|
+
|
15
|
+
var rformElems = /^(?:input|select|textarea)$/i,
|
16
|
+
rkeyEvent = /^key/,
|
17
|
+
rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
|
18
|
+
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
|
19
|
+
rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
|
20
|
+
|
21
|
+
function returnTrue() {
|
22
|
+
return true;
|
23
|
+
}
|
24
|
+
|
25
|
+
function returnFalse() {
|
26
|
+
return false;
|
27
|
+
}
|
28
|
+
|
29
|
+
// Support: IE9
|
30
|
+
// See #13393 for more info
|
31
|
+
function safeActiveElement() {
|
32
|
+
try {
|
33
|
+
return document.activeElement;
|
34
|
+
} catch ( err ) { }
|
35
|
+
}
|
36
|
+
|
37
|
+
function on( elem, types, selector, data, fn, one ) {
|
38
|
+
var origFn, type;
|
39
|
+
|
40
|
+
// Types can be a map of types/handlers
|
41
|
+
if ( typeof types === "object" ) {
|
42
|
+
|
43
|
+
// ( types-Object, selector, data )
|
44
|
+
if ( typeof selector !== "string" ) {
|
45
|
+
|
46
|
+
// ( types-Object, data )
|
47
|
+
data = data || selector;
|
48
|
+
selector = undefined;
|
49
|
+
}
|
50
|
+
for ( type in types ) {
|
51
|
+
on( elem, type, selector, data, types[ type ], one );
|
52
|
+
}
|
53
|
+
return elem;
|
54
|
+
}
|
55
|
+
|
56
|
+
if ( data == null && fn == null ) {
|
57
|
+
|
58
|
+
// ( types, fn )
|
59
|
+
fn = selector;
|
60
|
+
data = selector = undefined;
|
61
|
+
} else if ( fn == null ) {
|
62
|
+
if ( typeof selector === "string" ) {
|
63
|
+
|
64
|
+
// ( types, selector, fn )
|
65
|
+
fn = data;
|
66
|
+
data = undefined;
|
67
|
+
} else {
|
68
|
+
|
69
|
+
// ( types, data, fn )
|
70
|
+
fn = data;
|
71
|
+
data = selector;
|
72
|
+
selector = undefined;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
if ( fn === false ) {
|
76
|
+
fn = returnFalse;
|
77
|
+
} else if ( !fn ) {
|
78
|
+
return elem;
|
79
|
+
}
|
80
|
+
|
81
|
+
if ( one === 1 ) {
|
82
|
+
origFn = fn;
|
83
|
+
fn = function( event ) {
|
84
|
+
|
85
|
+
// Can use an empty set, since event contains the info
|
86
|
+
jQuery().off( event );
|
87
|
+
return origFn.apply( this, arguments );
|
88
|
+
};
|
89
|
+
|
90
|
+
// Use same guid so caller can remove using origFn
|
91
|
+
fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
|
92
|
+
}
|
93
|
+
return elem.each( function() {
|
94
|
+
jQuery.event.add( this, types, fn, data, selector );
|
95
|
+
} );
|
96
|
+
}
|
97
|
+
|
98
|
+
/*
|
99
|
+
* Helper functions for managing events -- not part of the public interface.
|
100
|
+
* Props to Dean Edwards' addEvent library for many of the ideas.
|
101
|
+
*/
|
102
|
+
jQuery.event = {
|
103
|
+
|
104
|
+
global: {},
|
105
|
+
|
106
|
+
add: function( elem, types, handler, data, selector ) {
|
107
|
+
var tmp, events, t, handleObjIn,
|
108
|
+
special, eventHandle, handleObj,
|
109
|
+
handlers, type, namespaces, origType,
|
110
|
+
elemData = jQuery._data( elem );
|
111
|
+
|
112
|
+
// Don't attach events to noData or text/comment nodes (but allow plain objects)
|
113
|
+
if ( !elemData ) {
|
114
|
+
return;
|
115
|
+
}
|
116
|
+
|
117
|
+
// Caller can pass in an object of custom data in lieu of the handler
|
118
|
+
if ( handler.handler ) {
|
119
|
+
handleObjIn = handler;
|
120
|
+
handler = handleObjIn.handler;
|
121
|
+
selector = handleObjIn.selector;
|
122
|
+
}
|
123
|
+
|
124
|
+
// Make sure that the handler has a unique ID, used to find/remove it later
|
125
|
+
if ( !handler.guid ) {
|
126
|
+
handler.guid = jQuery.guid++;
|
127
|
+
}
|
128
|
+
|
129
|
+
// Init the element's event structure and main handler, if this is the first
|
130
|
+
if ( !( events = elemData.events ) ) {
|
131
|
+
events = elemData.events = {};
|
132
|
+
}
|
133
|
+
if ( !( eventHandle = elemData.handle ) ) {
|
134
|
+
eventHandle = elemData.handle = function( e ) {
|
135
|
+
|
136
|
+
// Discard the second event of a jQuery.event.trigger() and
|
137
|
+
// when an event is called after a page has unloaded
|
138
|
+
return typeof jQuery !== "undefined" &&
|
139
|
+
( !e || jQuery.event.triggered !== e.type ) ?
|
140
|
+
jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
|
141
|
+
undefined;
|
142
|
+
};
|
143
|
+
|
144
|
+
// Add elem as a property of the handle fn to prevent a memory leak
|
145
|
+
// with IE non-native events
|
146
|
+
eventHandle.elem = elem;
|
147
|
+
}
|
148
|
+
|
149
|
+
// Handle multiple events separated by a space
|
150
|
+
types = ( types || "" ).match( rnotwhite ) || [ "" ];
|
151
|
+
t = types.length;
|
152
|
+
while ( t-- ) {
|
153
|
+
tmp = rtypenamespace.exec( types[ t ] ) || [];
|
154
|
+
type = origType = tmp[ 1 ];
|
155
|
+
namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
|
156
|
+
|
157
|
+
// There *must* be a type, no attaching namespace-only handlers
|
158
|
+
if ( !type ) {
|
159
|
+
continue;
|
160
|
+
}
|
161
|
+
|
162
|
+
// If event changes its type, use the special event handlers for the changed type
|
163
|
+
special = jQuery.event.special[ type ] || {};
|
164
|
+
|
165
|
+
// If selector defined, determine special event api type, otherwise given type
|
166
|
+
type = ( selector ? special.delegateType : special.bindType ) || type;
|
167
|
+
|
168
|
+
// Update special based on newly reset type
|
169
|
+
special = jQuery.event.special[ type ] || {};
|
170
|
+
|
171
|
+
// handleObj is passed to all event handlers
|
172
|
+
handleObj = jQuery.extend( {
|
173
|
+
type: type,
|
174
|
+
origType: origType,
|
175
|
+
data: data,
|
176
|
+
handler: handler,
|
177
|
+
guid: handler.guid,
|
178
|
+
selector: selector,
|
179
|
+
needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
|
180
|
+
namespace: namespaces.join( "." )
|
181
|
+
}, handleObjIn );
|
182
|
+
|
183
|
+
// Init the event handler queue if we're the first
|
184
|
+
if ( !( handlers = events[ type ] ) ) {
|
185
|
+
handlers = events[ type ] = [];
|
186
|
+
handlers.delegateCount = 0;
|
187
|
+
|
188
|
+
// Only use addEventListener/attachEvent if the special events handler returns false
|
189
|
+
if ( !special.setup ||
|
190
|
+
special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
|
191
|
+
|
192
|
+
// Bind the global event handler to the element
|
193
|
+
if ( elem.addEventListener ) {
|
194
|
+
elem.addEventListener( type, eventHandle, false );
|
195
|
+
|
196
|
+
} else if ( elem.attachEvent ) {
|
197
|
+
elem.attachEvent( "on" + type, eventHandle );
|
198
|
+
}
|
199
|
+
}
|
200
|
+
}
|
201
|
+
|
202
|
+
if ( special.add ) {
|
203
|
+
special.add.call( elem, handleObj );
|
204
|
+
|
205
|
+
if ( !handleObj.handler.guid ) {
|
206
|
+
handleObj.handler.guid = handler.guid;
|
207
|
+
}
|
208
|
+
}
|
209
|
+
|
210
|
+
// Add to the element's handler list, delegates in front
|
211
|
+
if ( selector ) {
|
212
|
+
handlers.splice( handlers.delegateCount++, 0, handleObj );
|
213
|
+
} else {
|
214
|
+
handlers.push( handleObj );
|
215
|
+
}
|
216
|
+
|
217
|
+
// Keep track of which events have ever been used, for event optimization
|
218
|
+
jQuery.event.global[ type ] = true;
|
219
|
+
}
|
220
|
+
|
221
|
+
// Nullify elem to prevent memory leaks in IE
|
222
|
+
elem = null;
|
223
|
+
},
|
224
|
+
|
225
|
+
// Detach an event or set of events from an element
|
226
|
+
remove: function( elem, types, handler, selector, mappedTypes ) {
|
227
|
+
var j, handleObj, tmp,
|
228
|
+
origCount, t, events,
|
229
|
+
special, handlers, type,
|
230
|
+
namespaces, origType,
|
231
|
+
elemData = jQuery.hasData( elem ) && jQuery._data( elem );
|
232
|
+
|
233
|
+
if ( !elemData || !( events = elemData.events ) ) {
|
234
|
+
return;
|
235
|
+
}
|
236
|
+
|
237
|
+
// Once for each type.namespace in types; type may be omitted
|
238
|
+
types = ( types || "" ).match( rnotwhite ) || [ "" ];
|
239
|
+
t = types.length;
|
240
|
+
while ( t-- ) {
|
241
|
+
tmp = rtypenamespace.exec( types[ t ] ) || [];
|
242
|
+
type = origType = tmp[ 1 ];
|
243
|
+
namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
|
244
|
+
|
245
|
+
// Unbind all events (on this namespace, if provided) for the element
|
246
|
+
if ( !type ) {
|
247
|
+
for ( type in events ) {
|
248
|
+
jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
|
249
|
+
}
|
250
|
+
continue;
|
251
|
+
}
|
252
|
+
|
253
|
+
special = jQuery.event.special[ type ] || {};
|
254
|
+
type = ( selector ? special.delegateType : special.bindType ) || type;
|
255
|
+
handlers = events[ type ] || [];
|
256
|
+
tmp = tmp[ 2 ] &&
|
257
|
+
new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
|
258
|
+
|
259
|
+
// Remove matching events
|
260
|
+
origCount = j = handlers.length;
|
261
|
+
while ( j-- ) {
|
262
|
+
handleObj = handlers[ j ];
|
263
|
+
|
264
|
+
if ( ( mappedTypes || origType === handleObj.origType ) &&
|
265
|
+
( !handler || handler.guid === handleObj.guid ) &&
|
266
|
+
( !tmp || tmp.test( handleObj.namespace ) ) &&
|
267
|
+
( !selector || selector === handleObj.selector ||
|
268
|
+
selector === "**" && handleObj.selector ) ) {
|
269
|
+
handlers.splice( j, 1 );
|
270
|
+
|
271
|
+
if ( handleObj.selector ) {
|
272
|
+
handlers.delegateCount--;
|
273
|
+
}
|
274
|
+
if ( special.remove ) {
|
275
|
+
special.remove.call( elem, handleObj );
|
276
|
+
}
|
277
|
+
}
|
278
|
+
}
|
279
|
+
|
280
|
+
// Remove generic event handler if we removed something and no more handlers exist
|
281
|
+
// (avoids potential for endless recursion during removal of special event handlers)
|
282
|
+
if ( origCount && !handlers.length ) {
|
283
|
+
if ( !special.teardown ||
|
284
|
+
special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
|
285
|
+
|
286
|
+
jQuery.removeEvent( elem, type, elemData.handle );
|
287
|
+
}
|
288
|
+
|
289
|
+
delete events[ type ];
|
290
|
+
}
|
291
|
+
}
|
292
|
+
|
293
|
+
// Remove the expando if it's no longer used
|
294
|
+
if ( jQuery.isEmptyObject( events ) ) {
|
295
|
+
delete elemData.handle;
|
296
|
+
|
297
|
+
// removeData also checks for emptiness and clears the expando if empty
|
298
|
+
// so use it instead of delete
|
299
|
+
jQuery._removeData( elem, "events" );
|
300
|
+
}
|
301
|
+
},
|
302
|
+
|
303
|
+
trigger: function( event, data, elem, onlyHandlers ) {
|
304
|
+
var handle, ontype, cur,
|
305
|
+
bubbleType, special, tmp, i,
|
306
|
+
eventPath = [ elem || document ],
|
307
|
+
type = hasOwn.call( event, "type" ) ? event.type : event,
|
308
|
+
namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
|
309
|
+
|
310
|
+
cur = tmp = elem = elem || document;
|
311
|
+
|
312
|
+
// Don't do events on text and comment nodes
|
313
|
+
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
|
314
|
+
return;
|
315
|
+
}
|
316
|
+
|
317
|
+
// focus/blur morphs to focusin/out; ensure we're not firing them right now
|
318
|
+
if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
|
319
|
+
return;
|
320
|
+
}
|
321
|
+
|
322
|
+
if ( type.indexOf( "." ) > -1 ) {
|
323
|
+
|
324
|
+
// Namespaced trigger; create a regexp to match event type in handle()
|
325
|
+
namespaces = type.split( "." );
|
326
|
+
type = namespaces.shift();
|
327
|
+
namespaces.sort();
|
328
|
+
}
|
329
|
+
ontype = type.indexOf( ":" ) < 0 && "on" + type;
|
330
|
+
|
331
|
+
// Caller can pass in a jQuery.Event object, Object, or just an event type string
|
332
|
+
event = event[ jQuery.expando ] ?
|
333
|
+
event :
|
334
|
+
new jQuery.Event( type, typeof event === "object" && event );
|
335
|
+
|
336
|
+
// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
|
337
|
+
event.isTrigger = onlyHandlers ? 2 : 3;
|
338
|
+
event.namespace = namespaces.join( "." );
|
339
|
+
event.rnamespace = event.namespace ?
|
340
|
+
new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
|
341
|
+
null;
|
342
|
+
|
343
|
+
// Clean up the event in case it is being reused
|
344
|
+
event.result = undefined;
|
345
|
+
if ( !event.target ) {
|
346
|
+
event.target = elem;
|
347
|
+
}
|
348
|
+
|
349
|
+
// Clone any incoming data and prepend the event, creating the handler arg list
|
350
|
+
data = data == null ?
|
351
|
+
[ event ] :
|
352
|
+
jQuery.makeArray( data, [ event ] );
|
353
|
+
|
354
|
+
// Allow special events to draw outside the lines
|
355
|
+
special = jQuery.event.special[ type ] || {};
|
356
|
+
if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
|
357
|
+
return;
|
358
|
+
}
|
359
|
+
|
360
|
+
// Determine event propagation path in advance, per W3C events spec (#9951)
|
361
|
+
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
|
362
|
+
if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
|
363
|
+
|
364
|
+
bubbleType = special.delegateType || type;
|
365
|
+
if ( !rfocusMorph.test( bubbleType + type ) ) {
|
366
|
+
cur = cur.parentNode;
|
367
|
+
}
|
368
|
+
for ( ; cur; cur = cur.parentNode ) {
|
369
|
+
eventPath.push( cur );
|
370
|
+
tmp = cur;
|
371
|
+
}
|
372
|
+
|
373
|
+
// Only add window if we got to document (e.g., not plain obj or detached DOM)
|
374
|
+
if ( tmp === ( elem.ownerDocument || document ) ) {
|
375
|
+
eventPath.push( tmp.defaultView || tmp.parentWindow || window );
|
376
|
+
}
|
377
|
+
}
|
378
|
+
|
379
|
+
// Fire handlers on the event path
|
380
|
+
i = 0;
|
381
|
+
while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
|
382
|
+
|
383
|
+
event.type = i > 1 ?
|
384
|
+
bubbleType :
|
385
|
+
special.bindType || type;
|
386
|
+
|
387
|
+
// jQuery handler
|
388
|
+
handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] &&
|
389
|
+
jQuery._data( cur, "handle" );
|
390
|
+
|
391
|
+
if ( handle ) {
|
392
|
+
handle.apply( cur, data );
|
393
|
+
}
|
394
|
+
|
395
|
+
// Native handler
|
396
|
+
handle = ontype && cur[ ontype ];
|
397
|
+
if ( handle && handle.apply && acceptData( cur ) ) {
|
398
|
+
event.result = handle.apply( cur, data );
|
399
|
+
if ( event.result === false ) {
|
400
|
+
event.preventDefault();
|
401
|
+
}
|
402
|
+
}
|
403
|
+
}
|
404
|
+
event.type = type;
|
405
|
+
|
406
|
+
// If nobody prevented the default action, do it now
|
407
|
+
if ( !onlyHandlers && !event.isDefaultPrevented() ) {
|
408
|
+
|
409
|
+
if (
|
410
|
+
( !special._default ||
|
411
|
+
special._default.apply( eventPath.pop(), data ) === false
|
412
|
+
) && acceptData( elem )
|
413
|
+
) {
|
414
|
+
|
415
|
+
// Call a native DOM method on the target with the same name name as the event.
|
416
|
+
// Can't use an .isFunction() check here because IE6/7 fails that test.
|
417
|
+
// Don't do default actions on window, that's where global variables be (#6170)
|
418
|
+
if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
|
419
|
+
|
420
|
+
// Don't re-trigger an onFOO event when we call its FOO() method
|
421
|
+
tmp = elem[ ontype ];
|
422
|
+
|
423
|
+
if ( tmp ) {
|
424
|
+
elem[ ontype ] = null;
|
425
|
+
}
|
426
|
+
|
427
|
+
// Prevent re-triggering of the same event, since we already bubbled it above
|
428
|
+
jQuery.event.triggered = type;
|
429
|
+
try {
|
430
|
+
elem[ type ]();
|
431
|
+
} catch ( e ) {
|
432
|
+
|
433
|
+
// IE<9 dies on focus/blur to hidden element (#1486,#12518)
|
434
|
+
// only reproducible on winXP IE8 native, not IE9 in IE8 mode
|
435
|
+
}
|
436
|
+
jQuery.event.triggered = undefined;
|
437
|
+
|
438
|
+
if ( tmp ) {
|
439
|
+
elem[ ontype ] = tmp;
|
440
|
+
}
|
441
|
+
}
|
442
|
+
}
|
443
|
+
}
|
444
|
+
|
445
|
+
return event.result;
|
446
|
+
},
|
447
|
+
|
448
|
+
dispatch: function( event ) {
|
449
|
+
|
450
|
+
// Make a writable jQuery.Event from the native event object
|
451
|
+
event = jQuery.event.fix( event );
|
452
|
+
|
453
|
+
var i, j, ret, matched, handleObj,
|
454
|
+
handlerQueue = [],
|
455
|
+
args = slice.call( arguments ),
|
456
|
+
handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
|
457
|
+
special = jQuery.event.special[ event.type ] || {};
|
458
|
+
|
459
|
+
// Use the fix-ed jQuery.Event rather than the (read-only) native event
|
460
|
+
args[ 0 ] = event;
|
461
|
+
event.delegateTarget = this;
|
462
|
+
|
463
|
+
// Call the preDispatch hook for the mapped type, and let it bail if desired
|
464
|
+
if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
|
465
|
+
return;
|
466
|
+
}
|
467
|
+
|
468
|
+
// Determine handlers
|
469
|
+
handlerQueue = jQuery.event.handlers.call( this, event, handlers );
|
470
|
+
|
471
|
+
// Run delegates first; they may want to stop propagation beneath us
|
472
|
+
i = 0;
|
473
|
+
while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
|
474
|
+
event.currentTarget = matched.elem;
|
475
|
+
|
476
|
+
j = 0;
|
477
|
+
while ( ( handleObj = matched.handlers[ j++ ] ) &&
|
478
|
+
!event.isImmediatePropagationStopped() ) {
|
479
|
+
|
480
|
+
// Triggered event must either 1) have no namespace, or 2) have namespace(s)
|
481
|
+
// a subset or equal to those in the bound event (both can have no namespace).
|
482
|
+
if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
|
483
|
+
|
484
|
+
event.handleObj = handleObj;
|
485
|
+
event.data = handleObj.data;
|
486
|
+
|
487
|
+
ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
|
488
|
+
handleObj.handler ).apply( matched.elem, args );
|
489
|
+
|
490
|
+
if ( ret !== undefined ) {
|
491
|
+
if ( ( event.result = ret ) === false ) {
|
492
|
+
event.preventDefault();
|
493
|
+
event.stopPropagation();
|
494
|
+
}
|
495
|
+
}
|
496
|
+
}
|
497
|
+
}
|
498
|
+
}
|
499
|
+
|
500
|
+
// Call the postDispatch hook for the mapped type
|
501
|
+
if ( special.postDispatch ) {
|
502
|
+
special.postDispatch.call( this, event );
|
503
|
+
}
|
504
|
+
|
505
|
+
return event.result;
|
506
|
+
},
|
507
|
+
|
508
|
+
handlers: function( event, handlers ) {
|
509
|
+
var i, matches, sel, handleObj,
|
510
|
+
handlerQueue = [],
|
511
|
+
delegateCount = handlers.delegateCount,
|
512
|
+
cur = event.target;
|
513
|
+
|
514
|
+
// Support (at least): Chrome, IE9
|
515
|
+
// Find delegate handlers
|
516
|
+
// Black-hole SVG <use> instance trees (#13180)
|
517
|
+
//
|
518
|
+
// Support: Firefox<=42+
|
519
|
+
// Avoid non-left-click in FF but don't block IE radio events (#3861, gh-2343)
|
520
|
+
if ( delegateCount && cur.nodeType &&
|
521
|
+
( event.type !== "click" || isNaN( event.button ) || event.button < 1 ) ) {
|
522
|
+
|
523
|
+
/* jshint eqeqeq: false */
|
524
|
+
for ( ; cur != this; cur = cur.parentNode || this ) {
|
525
|
+
/* jshint eqeqeq: true */
|
526
|
+
|
527
|
+
// Don't check non-elements (#13208)
|
528
|
+
// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
|
529
|
+
if ( cur.nodeType === 1 && ( cur.disabled !== true || event.type !== "click" ) ) {
|
530
|
+
matches = [];
|
531
|
+
for ( i = 0; i < delegateCount; i++ ) {
|
532
|
+
handleObj = handlers[ i ];
|
533
|
+
|
534
|
+
// Don't conflict with Object.prototype properties (#13203)
|
535
|
+
sel = handleObj.selector + " ";
|
536
|
+
|
537
|
+
if ( matches[ sel ] === undefined ) {
|
538
|
+
matches[ sel ] = handleObj.needsContext ?
|
539
|
+
jQuery( sel, this ).index( cur ) > -1 :
|
540
|
+
jQuery.find( sel, this, null, [ cur ] ).length;
|
541
|
+
}
|
542
|
+
if ( matches[ sel ] ) {
|
543
|
+
matches.push( handleObj );
|
544
|
+
}
|
545
|
+
}
|
546
|
+
if ( matches.length ) {
|
547
|
+
handlerQueue.push( { elem: cur, handlers: matches } );
|
548
|
+
}
|
549
|
+
}
|
550
|
+
}
|
551
|
+
}
|
552
|
+
|
553
|
+
// Add the remaining (directly-bound) handlers
|
554
|
+
if ( delegateCount < handlers.length ) {
|
555
|
+
handlerQueue.push( { elem: this, handlers: handlers.slice( delegateCount ) } );
|
556
|
+
}
|
557
|
+
|
558
|
+
return handlerQueue;
|
559
|
+
},
|
560
|
+
|
561
|
+
fix: function( event ) {
|
562
|
+
if ( event[ jQuery.expando ] ) {
|
563
|
+
return event;
|
564
|
+
}
|
565
|
+
|
566
|
+
// Create a writable copy of the event object and normalize some properties
|
567
|
+
var i, prop, copy,
|
568
|
+
type = event.type,
|
569
|
+
originalEvent = event,
|
570
|
+
fixHook = this.fixHooks[ type ];
|
571
|
+
|
572
|
+
if ( !fixHook ) {
|
573
|
+
this.fixHooks[ type ] = fixHook =
|
574
|
+
rmouseEvent.test( type ) ? this.mouseHooks :
|
575
|
+
rkeyEvent.test( type ) ? this.keyHooks :
|
576
|
+
{};
|
577
|
+
}
|
578
|
+
copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
|
579
|
+
|
580
|
+
event = new jQuery.Event( originalEvent );
|
581
|
+
|
582
|
+
i = copy.length;
|
583
|
+
while ( i-- ) {
|
584
|
+
prop = copy[ i ];
|
585
|
+
event[ prop ] = originalEvent[ prop ];
|
586
|
+
}
|
587
|
+
|
588
|
+
// Support: IE<9
|
589
|
+
// Fix target property (#1925)
|
590
|
+
if ( !event.target ) {
|
591
|
+
event.target = originalEvent.srcElement || document;
|
592
|
+
}
|
593
|
+
|
594
|
+
// Support: Safari 6-8+
|
595
|
+
// Target should not be a text node (#504, #13143)
|
596
|
+
if ( event.target.nodeType === 3 ) {
|
597
|
+
event.target = event.target.parentNode;
|
598
|
+
}
|
599
|
+
|
600
|
+
// Support: IE<9
|
601
|
+
// For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
|
602
|
+
event.metaKey = !!event.metaKey;
|
603
|
+
|
604
|
+
return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
|
605
|
+
},
|
606
|
+
|
607
|
+
// Includes some event props shared by KeyEvent and MouseEvent
|
608
|
+
props: ( "altKey bubbles cancelable ctrlKey currentTarget detail eventPhase " +
|
609
|
+
"metaKey relatedTarget shiftKey target timeStamp view which" ).split( " " ),
|
610
|
+
|
611
|
+
fixHooks: {},
|
612
|
+
|
613
|
+
keyHooks: {
|
614
|
+
props: "char charCode key keyCode".split( " " ),
|
615
|
+
filter: function( event, original ) {
|
616
|
+
|
617
|
+
// Add which for key events
|
618
|
+
if ( event.which == null ) {
|
619
|
+
event.which = original.charCode != null ? original.charCode : original.keyCode;
|
620
|
+
}
|
621
|
+
|
622
|
+
return event;
|
623
|
+
}
|
624
|
+
},
|
625
|
+
|
626
|
+
mouseHooks: {
|
627
|
+
props: ( "button buttons clientX clientY fromElement offsetX offsetY " +
|
628
|
+
"pageX pageY screenX screenY toElement" ).split( " " ),
|
629
|
+
filter: function( event, original ) {
|
630
|
+
var body, eventDoc, doc,
|
631
|
+
button = original.button,
|
632
|
+
fromElement = original.fromElement;
|
633
|
+
|
634
|
+
// Calculate pageX/Y if missing and clientX/Y available
|
635
|
+
if ( event.pageX == null && original.clientX != null ) {
|
636
|
+
eventDoc = event.target.ownerDocument || document;
|
637
|
+
doc = eventDoc.documentElement;
|
638
|
+
body = eventDoc.body;
|
639
|
+
|
640
|
+
event.pageX = original.clientX +
|
641
|
+
( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) -
|
642
|
+
( doc && doc.clientLeft || body && body.clientLeft || 0 );
|
643
|
+
event.pageY = original.clientY +
|
644
|
+
( doc && doc.scrollTop || body && body.scrollTop || 0 ) -
|
645
|
+
( doc && doc.clientTop || body && body.clientTop || 0 );
|
646
|
+
}
|
647
|
+
|
648
|
+
// Add relatedTarget, if necessary
|
649
|
+
if ( !event.relatedTarget && fromElement ) {
|
650
|
+
event.relatedTarget = fromElement === event.target ?
|
651
|
+
original.toElement :
|
652
|
+
fromElement;
|
653
|
+
}
|
654
|
+
|
655
|
+
// Add which for click: 1 === left; 2 === middle; 3 === right
|
656
|
+
// Note: button is not normalized, so don't use it
|
657
|
+
if ( !event.which && button !== undefined ) {
|
658
|
+
event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
|
659
|
+
}
|
660
|
+
|
661
|
+
return event;
|
662
|
+
}
|
663
|
+
},
|
664
|
+
|
665
|
+
special: {
|
666
|
+
load: {
|
667
|
+
|
668
|
+
// Prevent triggered image.load events from bubbling to window.load
|
669
|
+
noBubble: true
|
670
|
+
},
|
671
|
+
focus: {
|
672
|
+
|
673
|
+
// Fire native event if possible so blur/focus sequence is correct
|
674
|
+
trigger: function() {
|
675
|
+
if ( this !== safeActiveElement() && this.focus ) {
|
676
|
+
try {
|
677
|
+
this.focus();
|
678
|
+
return false;
|
679
|
+
} catch ( e ) {
|
680
|
+
|
681
|
+
// Support: IE<9
|
682
|
+
// If we error on focus to hidden element (#1486, #12518),
|
683
|
+
// let .trigger() run the handlers
|
684
|
+
}
|
685
|
+
}
|
686
|
+
},
|
687
|
+
delegateType: "focusin"
|
688
|
+
},
|
689
|
+
blur: {
|
690
|
+
trigger: function() {
|
691
|
+
if ( this === safeActiveElement() && this.blur ) {
|
692
|
+
this.blur();
|
693
|
+
return false;
|
694
|
+
}
|
695
|
+
},
|
696
|
+
delegateType: "focusout"
|
697
|
+
},
|
698
|
+
click: {
|
699
|
+
|
700
|
+
// For checkbox, fire native event so checked state will be right
|
701
|
+
trigger: function() {
|
702
|
+
if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) {
|
703
|
+
this.click();
|
704
|
+
return false;
|
705
|
+
}
|
706
|
+
},
|
707
|
+
|
708
|
+
// For cross-browser consistency, don't fire native .click() on links
|
709
|
+
_default: function( event ) {
|
710
|
+
return jQuery.nodeName( event.target, "a" );
|
711
|
+
}
|
712
|
+
},
|
713
|
+
|
714
|
+
beforeunload: {
|
715
|
+
postDispatch: function( event ) {
|
716
|
+
|
717
|
+
// Support: Firefox 20+
|
718
|
+
// Firefox doesn't alert if the returnValue field is not set.
|
719
|
+
if ( event.result !== undefined && event.originalEvent ) {
|
720
|
+
event.originalEvent.returnValue = event.result;
|
721
|
+
}
|
722
|
+
}
|
723
|
+
}
|
724
|
+
},
|
725
|
+
|
726
|
+
// Piggyback on a donor event to simulate a different one
|
727
|
+
simulate: function( type, elem, event ) {
|
728
|
+
var e = jQuery.extend(
|
729
|
+
new jQuery.Event(),
|
730
|
+
event,
|
731
|
+
{
|
732
|
+
type: type,
|
733
|
+
isSimulated: true
|
734
|
+
|
735
|
+
// Previously, `originalEvent: {}` was set here, so stopPropagation call
|
736
|
+
// would not be triggered on donor event, since in our own
|
737
|
+
// jQuery.event.stopPropagation function we had a check for existence of
|
738
|
+
// originalEvent.stopPropagation method, so, consequently it would be a noop.
|
739
|
+
//
|
740
|
+
// Guard for simulated events was moved to jQuery.event.stopPropagation function
|
741
|
+
// since `originalEvent` should point to the original event for the
|
742
|
+
// constancy with other events and for more focused logic
|
743
|
+
}
|
744
|
+
);
|
745
|
+
|
746
|
+
jQuery.event.trigger( e, null, elem );
|
747
|
+
|
748
|
+
if ( e.isDefaultPrevented() ) {
|
749
|
+
event.preventDefault();
|
750
|
+
}
|
751
|
+
}
|
752
|
+
};
|
753
|
+
|
754
|
+
jQuery.removeEvent = document.removeEventListener ?
|
755
|
+
function( elem, type, handle ) {
|
756
|
+
|
757
|
+
// This "if" is needed for plain objects
|
758
|
+
if ( elem.removeEventListener ) {
|
759
|
+
elem.removeEventListener( type, handle );
|
760
|
+
}
|
761
|
+
} :
|
762
|
+
function( elem, type, handle ) {
|
763
|
+
var name = "on" + type;
|
764
|
+
|
765
|
+
if ( elem.detachEvent ) {
|
766
|
+
|
767
|
+
// #8545, #7054, preventing memory leaks for custom events in IE6-8
|
768
|
+
// detachEvent needed property on element, by name of that event,
|
769
|
+
// to properly expose it to GC
|
770
|
+
if ( typeof elem[ name ] === "undefined" ) {
|
771
|
+
elem[ name ] = null;
|
772
|
+
}
|
773
|
+
|
774
|
+
elem.detachEvent( name, handle );
|
775
|
+
}
|
776
|
+
};
|
777
|
+
|
778
|
+
jQuery.Event = function( src, props ) {
|
779
|
+
|
780
|
+
// Allow instantiation without the 'new' keyword
|
781
|
+
if ( !( this instanceof jQuery.Event ) ) {
|
782
|
+
return new jQuery.Event( src, props );
|
783
|
+
}
|
784
|
+
|
785
|
+
// Event object
|
786
|
+
if ( src && src.type ) {
|
787
|
+
this.originalEvent = src;
|
788
|
+
this.type = src.type;
|
789
|
+
|
790
|
+
// Events bubbling up the document may have been marked as prevented
|
791
|
+
// by a handler lower down the tree; reflect the correct value.
|
792
|
+
this.isDefaultPrevented = src.defaultPrevented ||
|
793
|
+
src.defaultPrevented === undefined &&
|
794
|
+
|
795
|
+
// Support: IE < 9, Android < 4.0
|
796
|
+
src.returnValue === false ?
|
797
|
+
returnTrue :
|
798
|
+
returnFalse;
|
799
|
+
|
800
|
+
// Event type
|
801
|
+
} else {
|
802
|
+
this.type = src;
|
803
|
+
}
|
804
|
+
|
805
|
+
// Put explicitly provided properties onto the event object
|
806
|
+
if ( props ) {
|
807
|
+
jQuery.extend( this, props );
|
808
|
+
}
|
809
|
+
|
810
|
+
// Create a timestamp if incoming event doesn't have one
|
811
|
+
this.timeStamp = src && src.timeStamp || jQuery.now();
|
812
|
+
|
813
|
+
// Mark it as fixed
|
814
|
+
this[ jQuery.expando ] = true;
|
815
|
+
};
|
816
|
+
|
817
|
+
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
|
818
|
+
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
|
819
|
+
jQuery.Event.prototype = {
|
820
|
+
constructor: jQuery.Event,
|
821
|
+
isDefaultPrevented: returnFalse,
|
822
|
+
isPropagationStopped: returnFalse,
|
823
|
+
isImmediatePropagationStopped: returnFalse,
|
824
|
+
|
825
|
+
preventDefault: function() {
|
826
|
+
var e = this.originalEvent;
|
827
|
+
|
828
|
+
this.isDefaultPrevented = returnTrue;
|
829
|
+
if ( !e ) {
|
830
|
+
return;
|
831
|
+
}
|
832
|
+
|
833
|
+
// If preventDefault exists, run it on the original event
|
834
|
+
if ( e.preventDefault ) {
|
835
|
+
e.preventDefault();
|
836
|
+
|
837
|
+
// Support: IE
|
838
|
+
// Otherwise set the returnValue property of the original event to false
|
839
|
+
} else {
|
840
|
+
e.returnValue = false;
|
841
|
+
}
|
842
|
+
},
|
843
|
+
stopPropagation: function() {
|
844
|
+
var e = this.originalEvent;
|
845
|
+
|
846
|
+
this.isPropagationStopped = returnTrue;
|
847
|
+
|
848
|
+
if ( !e || this.isSimulated ) {
|
849
|
+
return;
|
850
|
+
}
|
851
|
+
|
852
|
+
// If stopPropagation exists, run it on the original event
|
853
|
+
if ( e.stopPropagation ) {
|
854
|
+
e.stopPropagation();
|
855
|
+
}
|
856
|
+
|
857
|
+
// Support: IE
|
858
|
+
// Set the cancelBubble property of the original event to true
|
859
|
+
e.cancelBubble = true;
|
860
|
+
},
|
861
|
+
stopImmediatePropagation: function() {
|
862
|
+
var e = this.originalEvent;
|
863
|
+
|
864
|
+
this.isImmediatePropagationStopped = returnTrue;
|
865
|
+
|
866
|
+
if ( e && e.stopImmediatePropagation ) {
|
867
|
+
e.stopImmediatePropagation();
|
868
|
+
}
|
869
|
+
|
870
|
+
this.stopPropagation();
|
871
|
+
}
|
872
|
+
};
|
873
|
+
|
874
|
+
// Create mouseenter/leave events using mouseover/out and event-time checks
|
875
|
+
// so that event delegation works in jQuery.
|
876
|
+
// Do the same for pointerenter/pointerleave and pointerover/pointerout
|
877
|
+
//
|
878
|
+
// Support: Safari 7 only
|
879
|
+
// Safari sends mouseenter too often; see:
|
880
|
+
// https://code.google.com/p/chromium/issues/detail?id=470258
|
881
|
+
// for the description of the bug (it existed in older Chrome versions as well).
|
882
|
+
jQuery.each( {
|
883
|
+
mouseenter: "mouseover",
|
884
|
+
mouseleave: "mouseout",
|
885
|
+
pointerenter: "pointerover",
|
886
|
+
pointerleave: "pointerout"
|
887
|
+
}, function( orig, fix ) {
|
888
|
+
jQuery.event.special[ orig ] = {
|
889
|
+
delegateType: fix,
|
890
|
+
bindType: fix,
|
891
|
+
|
892
|
+
handle: function( event ) {
|
893
|
+
var ret,
|
894
|
+
target = this,
|
895
|
+
related = event.relatedTarget,
|
896
|
+
handleObj = event.handleObj;
|
897
|
+
|
898
|
+
// For mouseenter/leave call the handler if related is outside the target.
|
899
|
+
// NB: No relatedTarget if the mouse left/entered the browser window
|
900
|
+
if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
|
901
|
+
event.type = handleObj.origType;
|
902
|
+
ret = handleObj.handler.apply( this, arguments );
|
903
|
+
event.type = fix;
|
904
|
+
}
|
905
|
+
return ret;
|
906
|
+
}
|
907
|
+
};
|
908
|
+
} );
|
909
|
+
|
910
|
+
// IE submit delegation
|
911
|
+
if ( !support.submit ) {
|
912
|
+
|
913
|
+
jQuery.event.special.submit = {
|
914
|
+
setup: function() {
|
915
|
+
|
916
|
+
// Only need this for delegated form submit events
|
917
|
+
if ( jQuery.nodeName( this, "form" ) ) {
|
918
|
+
return false;
|
919
|
+
}
|
920
|
+
|
921
|
+
// Lazy-add a submit handler when a descendant form may potentially be submitted
|
922
|
+
jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
|
923
|
+
|
924
|
+
// Node name check avoids a VML-related crash in IE (#9807)
|
925
|
+
var elem = e.target,
|
926
|
+
form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ?
|
927
|
+
|
928
|
+
// Support: IE <=8
|
929
|
+
// We use jQuery.prop instead of elem.form
|
930
|
+
// to allow fixing the IE8 delegated submit issue (gh-2332)
|
931
|
+
// by 3rd party polyfills/workarounds.
|
932
|
+
jQuery.prop( elem, "form" ) :
|
933
|
+
undefined;
|
934
|
+
|
935
|
+
if ( form && !jQuery._data( form, "submit" ) ) {
|
936
|
+
jQuery.event.add( form, "submit._submit", function( event ) {
|
937
|
+
event._submitBubble = true;
|
938
|
+
} );
|
939
|
+
jQuery._data( form, "submit", true );
|
940
|
+
}
|
941
|
+
} );
|
942
|
+
|
943
|
+
// return undefined since we don't need an event listener
|
944
|
+
},
|
945
|
+
|
946
|
+
postDispatch: function( event ) {
|
947
|
+
|
948
|
+
// If form was submitted by the user, bubble the event up the tree
|
949
|
+
if ( event._submitBubble ) {
|
950
|
+
delete event._submitBubble;
|
951
|
+
if ( this.parentNode && !event.isTrigger ) {
|
952
|
+
jQuery.event.simulate( "submit", this.parentNode, event );
|
953
|
+
}
|
954
|
+
}
|
955
|
+
},
|
956
|
+
|
957
|
+
teardown: function() {
|
958
|
+
|
959
|
+
// Only need this for delegated form submit events
|
960
|
+
if ( jQuery.nodeName( this, "form" ) ) {
|
961
|
+
return false;
|
962
|
+
}
|
963
|
+
|
964
|
+
// Remove delegated handlers; cleanData eventually reaps submit handlers attached above
|
965
|
+
jQuery.event.remove( this, "._submit" );
|
966
|
+
}
|
967
|
+
};
|
968
|
+
}
|
969
|
+
|
970
|
+
// IE change delegation and checkbox/radio fix
|
971
|
+
if ( !support.change ) {
|
972
|
+
|
973
|
+
jQuery.event.special.change = {
|
974
|
+
|
975
|
+
setup: function() {
|
976
|
+
|
977
|
+
if ( rformElems.test( this.nodeName ) ) {
|
978
|
+
|
979
|
+
// IE doesn't fire change on a check/radio until blur; trigger it on click
|
980
|
+
// after a propertychange. Eat the blur-change in special.change.handle.
|
981
|
+
// This still fires onchange a second time for check/radio after blur.
|
982
|
+
if ( this.type === "checkbox" || this.type === "radio" ) {
|
983
|
+
jQuery.event.add( this, "propertychange._change", function( event ) {
|
984
|
+
if ( event.originalEvent.propertyName === "checked" ) {
|
985
|
+
this._justChanged = true;
|
986
|
+
}
|
987
|
+
} );
|
988
|
+
jQuery.event.add( this, "click._change", function( event ) {
|
989
|
+
if ( this._justChanged && !event.isTrigger ) {
|
990
|
+
this._justChanged = false;
|
991
|
+
}
|
992
|
+
|
993
|
+
// Allow triggered, simulated change events (#11500)
|
994
|
+
jQuery.event.simulate( "change", this, event );
|
995
|
+
} );
|
996
|
+
}
|
997
|
+
return false;
|
998
|
+
}
|
999
|
+
|
1000
|
+
// Delegated event; lazy-add a change handler on descendant inputs
|
1001
|
+
jQuery.event.add( this, "beforeactivate._change", function( e ) {
|
1002
|
+
var elem = e.target;
|
1003
|
+
|
1004
|
+
if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "change" ) ) {
|
1005
|
+
jQuery.event.add( elem, "change._change", function( event ) {
|
1006
|
+
if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
|
1007
|
+
jQuery.event.simulate( "change", this.parentNode, event );
|
1008
|
+
}
|
1009
|
+
} );
|
1010
|
+
jQuery._data( elem, "change", true );
|
1011
|
+
}
|
1012
|
+
} );
|
1013
|
+
},
|
1014
|
+
|
1015
|
+
handle: function( event ) {
|
1016
|
+
var elem = event.target;
|
1017
|
+
|
1018
|
+
// Swallow native change events from checkbox/radio, we already triggered them above
|
1019
|
+
if ( this !== elem || event.isSimulated || event.isTrigger ||
|
1020
|
+
( elem.type !== "radio" && elem.type !== "checkbox" ) ) {
|
1021
|
+
|
1022
|
+
return event.handleObj.handler.apply( this, arguments );
|
1023
|
+
}
|
1024
|
+
},
|
1025
|
+
|
1026
|
+
teardown: function() {
|
1027
|
+
jQuery.event.remove( this, "._change" );
|
1028
|
+
|
1029
|
+
return !rformElems.test( this.nodeName );
|
1030
|
+
}
|
1031
|
+
};
|
1032
|
+
}
|
1033
|
+
|
1034
|
+
// Support: Firefox
|
1035
|
+
// Firefox doesn't have focus(in | out) events
|
1036
|
+
// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
|
1037
|
+
//
|
1038
|
+
// Support: Chrome, Safari
|
1039
|
+
// focus(in | out) events fire after focus & blur events,
|
1040
|
+
// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
|
1041
|
+
// Related ticket - https://code.google.com/p/chromium/issues/detail?id=449857
|
1042
|
+
if ( !support.focusin ) {
|
1043
|
+
jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
|
1044
|
+
|
1045
|
+
// Attach a single capturing handler on the document while someone wants focusin/focusout
|
1046
|
+
var handler = function( event ) {
|
1047
|
+
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
|
1048
|
+
};
|
1049
|
+
|
1050
|
+
jQuery.event.special[ fix ] = {
|
1051
|
+
setup: function() {
|
1052
|
+
var doc = this.ownerDocument || this,
|
1053
|
+
attaches = jQuery._data( doc, fix );
|
1054
|
+
|
1055
|
+
if ( !attaches ) {
|
1056
|
+
doc.addEventListener( orig, handler, true );
|
1057
|
+
}
|
1058
|
+
jQuery._data( doc, fix, ( attaches || 0 ) + 1 );
|
1059
|
+
},
|
1060
|
+
teardown: function() {
|
1061
|
+
var doc = this.ownerDocument || this,
|
1062
|
+
attaches = jQuery._data( doc, fix ) - 1;
|
1063
|
+
|
1064
|
+
if ( !attaches ) {
|
1065
|
+
doc.removeEventListener( orig, handler, true );
|
1066
|
+
jQuery._removeData( doc, fix );
|
1067
|
+
} else {
|
1068
|
+
jQuery._data( doc, fix, attaches );
|
1069
|
+
}
|
1070
|
+
}
|
1071
|
+
};
|
1072
|
+
} );
|
1073
|
+
}
|
1074
|
+
|
1075
|
+
jQuery.fn.extend( {
|
1076
|
+
|
1077
|
+
on: function( types, selector, data, fn ) {
|
1078
|
+
return on( this, types, selector, data, fn );
|
1079
|
+
},
|
1080
|
+
one: function( types, selector, data, fn ) {
|
1081
|
+
return on( this, types, selector, data, fn, 1 );
|
1082
|
+
},
|
1083
|
+
off: function( types, selector, fn ) {
|
1084
|
+
var handleObj, type;
|
1085
|
+
if ( types && types.preventDefault && types.handleObj ) {
|
1086
|
+
|
1087
|
+
// ( event ) dispatched jQuery.Event
|
1088
|
+
handleObj = types.handleObj;
|
1089
|
+
jQuery( types.delegateTarget ).off(
|
1090
|
+
handleObj.namespace ?
|
1091
|
+
handleObj.origType + "." + handleObj.namespace :
|
1092
|
+
handleObj.origType,
|
1093
|
+
handleObj.selector,
|
1094
|
+
handleObj.handler
|
1095
|
+
);
|
1096
|
+
return this;
|
1097
|
+
}
|
1098
|
+
if ( typeof types === "object" ) {
|
1099
|
+
|
1100
|
+
// ( types-object [, selector] )
|
1101
|
+
for ( type in types ) {
|
1102
|
+
this.off( type, selector, types[ type ] );
|
1103
|
+
}
|
1104
|
+
return this;
|
1105
|
+
}
|
1106
|
+
if ( selector === false || typeof selector === "function" ) {
|
1107
|
+
|
1108
|
+
// ( types [, fn] )
|
1109
|
+
fn = selector;
|
1110
|
+
selector = undefined;
|
1111
|
+
}
|
1112
|
+
if ( fn === false ) {
|
1113
|
+
fn = returnFalse;
|
1114
|
+
}
|
1115
|
+
return this.each( function() {
|
1116
|
+
jQuery.event.remove( this, types, fn, selector );
|
1117
|
+
} );
|
1118
|
+
},
|
1119
|
+
|
1120
|
+
trigger: function( type, data ) {
|
1121
|
+
return this.each( function() {
|
1122
|
+
jQuery.event.trigger( type, data, this );
|
1123
|
+
} );
|
1124
|
+
},
|
1125
|
+
triggerHandler: function( type, data ) {
|
1126
|
+
var elem = this[ 0 ];
|
1127
|
+
if ( elem ) {
|
1128
|
+
return jQuery.event.trigger( type, data, elem, true );
|
1129
|
+
}
|
1130
|
+
}
|
1131
|
+
} );
|
1132
|
+
|
1133
|
+
return jQuery;
|
1134
|
+
} );
|