guff-compass 0.7.0

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