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