1 | define( [
|
2 | "./core",
|
3 | "./var/document",
|
4 | "./var/documentElement",
|
5 | "./var/isFunction",
|
6 | "./var/rnothtmlwhite",
|
7 | "./var/rcheckableType",
|
8 | "./var/slice",
|
9 | "./data/var/acceptData",
|
10 | "./data/var/dataPriv",
|
11 | "./core/nodeName",
|
12 |
|
13 | "./core/init",
|
14 | "./selector"
|
15 | ], function( jQuery, document, documentElement, isFunction, rnothtmlwhite,
|
16 | rcheckableType, slice, acceptData, dataPriv, nodeName ) {
|
17 |
|
18 | "use strict";
|
19 |
|
20 | var
|
21 | rkeyEvent = /^key/,
|
22 | rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
|
23 | rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
|
24 |
|
25 | function returnTrue() {
|
26 | return true;
|
27 | }
|
28 |
|
29 | function returnFalse() {
|
30 | return false;
|
31 | }
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 | function expectSync( elem, type ) {
|
40 | return ( elem === safeActiveElement() ) === ( type === "focus" );
|
41 | }
|
42 |
|
43 |
|
44 |
|
45 |
|
46 | function safeActiveElement() {
|
47 | try {
|
48 | return document.activeElement;
|
49 | } catch ( err ) { }
|
50 | }
|
51 |
|
52 | function on( elem, types, selector, data, fn, one ) {
|
53 | var origFn, type;
|
54 |
|
55 |
|
56 | if ( typeof types === "object" ) {
|
57 |
|
58 |
|
59 | if ( typeof selector !== "string" ) {
|
60 |
|
61 |
|
62 | data = data || selector;
|
63 | selector = undefined;
|
64 | }
|
65 | for ( type in types ) {
|
66 | on( elem, type, selector, data, types[ type ], one );
|
67 | }
|
68 | return elem;
|
69 | }
|
70 |
|
71 | if ( data == null && fn == null ) {
|
72 |
|
73 |
|
74 | fn = selector;
|
75 | data = selector = undefined;
|
76 | } else if ( fn == null ) {
|
77 | if ( typeof selector === "string" ) {
|
78 |
|
79 |
|
80 | fn = data;
|
81 | data = undefined;
|
82 | } else {
|
83 |
|
84 |
|
85 | fn = data;
|
86 | data = selector;
|
87 | selector = undefined;
|
88 | }
|
89 | }
|
90 | if ( fn === false ) {
|
91 | fn = returnFalse;
|
92 | } else if ( !fn ) {
|
93 | return elem;
|
94 | }
|
95 |
|
96 | if ( one === 1 ) {
|
97 | origFn = fn;
|
98 | fn = function( event ) {
|
99 |
|
100 |
|
101 | jQuery().off( event );
|
102 | return origFn.apply( this, arguments );
|
103 | };
|
104 |
|
105 |
|
106 | fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
|
107 | }
|
108 | return elem.each( function() {
|
109 | jQuery.event.add( this, types, fn, data, selector );
|
110 | } );
|
111 | }
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 | jQuery.event = {
|
118 |
|
119 | global: {},
|
120 |
|
121 | add: function( elem, types, handler, data, selector ) {
|
122 |
|
123 | var handleObjIn, eventHandle, tmp,
|
124 | events, t, handleObj,
|
125 | special, handlers, type, namespaces, origType,
|
126 | elemData = dataPriv.get( elem );
|
127 |
|
128 |
|
129 | if ( !acceptData( elem ) ) {
|
130 | return;
|
131 | }
|
132 |
|
133 |
|
134 | if ( handler.handler ) {
|
135 | handleObjIn = handler;
|
136 | handler = handleObjIn.handler;
|
137 | selector = handleObjIn.selector;
|
138 | }
|
139 |
|
140 |
|
141 |
|
142 | if ( selector ) {
|
143 | jQuery.find.matchesSelector( documentElement, selector );
|
144 | }
|
145 |
|
146 |
|
147 | if ( !handler.guid ) {
|
148 | handler.guid = jQuery.guid++;
|
149 | }
|
150 |
|
151 |
|
152 | if ( !( events = elemData.events ) ) {
|
153 | events = elemData.events = Object.create( null );
|
154 | }
|
155 | if ( !( eventHandle = elemData.handle ) ) {
|
156 | eventHandle = elemData.handle = function( e ) {
|
157 |
|
158 |
|
159 |
|
160 | return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
|
161 | jQuery.event.dispatch.apply( elem, arguments ) : undefined;
|
162 | };
|
163 | }
|
164 |
|
165 |
|
166 | types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
|
167 | t = types.length;
|
168 | while ( t-- ) {
|
169 | tmp = rtypenamespace.exec( types[ t ] ) || [];
|
170 | type = origType = tmp[ 1 ];
|
171 | namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
|
172 |
|
173 |
|
174 | if ( !type ) {
|
175 | continue;
|
176 | }
|
177 |
|
178 |
|
179 | special = jQuery.event.special[ type ] || {};
|
180 |
|
181 |
|
182 | type = ( selector ? special.delegateType : special.bindType ) || type;
|
183 |
|
184 |
|
185 | special = jQuery.event.special[ type ] || {};
|
186 |
|
187 |
|
188 | handleObj = jQuery.extend( {
|
189 | type: type,
|
190 | origType: origType,
|
191 | data: data,
|
192 | handler: handler,
|
193 | guid: handler.guid,
|
194 | selector: selector,
|
195 | needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
|
196 | namespace: namespaces.join( "." )
|
197 | }, handleObjIn );
|
198 |
|
199 |
|
200 | if ( !( handlers = events[ type ] ) ) {
|
201 | handlers = events[ type ] = [];
|
202 | handlers.delegateCount = 0;
|
203 |
|
204 |
|
205 | if ( !special.setup ||
|
206 | special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
|
207 |
|
208 | if ( elem.addEventListener ) {
|
209 | elem.addEventListener( type, eventHandle );
|
210 | }
|
211 | }
|
212 | }
|
213 |
|
214 | if ( special.add ) {
|
215 | special.add.call( elem, handleObj );
|
216 |
|
217 | if ( !handleObj.handler.guid ) {
|
218 | handleObj.handler.guid = handler.guid;
|
219 | }
|
220 | }
|
221 |
|
222 |
|
223 | if ( selector ) {
|
224 | handlers.splice( handlers.delegateCount++, 0, handleObj );
|
225 | } else {
|
226 | handlers.push( handleObj );
|
227 | }
|
228 |
|
229 |
|
230 | jQuery.event.global[ type ] = true;
|
231 | }
|
232 |
|
233 | },
|
234 |
|
235 |
|
236 | remove: function( elem, types, handler, selector, mappedTypes ) {
|
237 |
|
238 | var j, origCount, tmp,
|
239 | events, t, handleObj,
|
240 | special, handlers, type, namespaces, origType,
|
241 | elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
|
242 |
|
243 | if ( !elemData || !( events = elemData.events ) ) {
|
244 | return;
|
245 | }
|
246 |
|
247 |
|
248 | types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
|
249 | t = types.length;
|
250 | while ( t-- ) {
|
251 | tmp = rtypenamespace.exec( types[ t ] ) || [];
|
252 | type = origType = tmp[ 1 ];
|
253 | namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
|
254 |
|
255 |
|
256 | if ( !type ) {
|
257 | for ( type in events ) {
|
258 | jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
|
259 | }
|
260 | continue;
|
261 | }
|
262 |
|
263 | special = jQuery.event.special[ type ] || {};
|
264 | type = ( selector ? special.delegateType : special.bindType ) || type;
|
265 | handlers = events[ type ] || [];
|
266 | tmp = tmp[ 2 ] &&
|
267 | new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
|
268 |
|
269 |
|
270 | origCount = j = handlers.length;
|
271 | while ( j-- ) {
|
272 | handleObj = handlers[ j ];
|
273 |
|
274 | if ( ( mappedTypes || origType === handleObj.origType ) &&
|
275 | ( !handler || handler.guid === handleObj.guid ) &&
|
276 | ( !tmp || tmp.test( handleObj.namespace ) ) &&
|
277 | ( !selector || selector === handleObj.selector ||
|
278 | selector === "**" && handleObj.selector ) ) {
|
279 | handlers.splice( j, 1 );
|
280 |
|
281 | if ( handleObj.selector ) {
|
282 | handlers.delegateCount--;
|
283 | }
|
284 | if ( special.remove ) {
|
285 | special.remove.call( elem, handleObj );
|
286 | }
|
287 | }
|
288 | }
|
289 |
|
290 |
|
291 |
|
292 | if ( origCount && !handlers.length ) {
|
293 | if ( !special.teardown ||
|
294 | special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
|
295 |
|
296 | jQuery.removeEvent( elem, type, elemData.handle );
|
297 | }
|
298 |
|
299 | delete events[ type ];
|
300 | }
|
301 | }
|
302 |
|
303 |
|
304 | if ( jQuery.isEmptyObject( events ) ) {
|
305 | dataPriv.remove( elem, "handle events" );
|
306 | }
|
307 | },
|
308 |
|
309 | dispatch: function( nativeEvent ) {
|
310 |
|
311 | var i, j, ret, matched, handleObj, handlerQueue,
|
312 | args = new Array( arguments.length ),
|
313 |
|
314 |
|
315 | event = jQuery.event.fix( nativeEvent ),
|
316 |
|
317 | handlers = (
|
318 | dataPriv.get( this, "events" ) || Object.create( null )
|
319 | )[ event.type ] || [],
|
320 | special = jQuery.event.special[ event.type ] || {};
|
321 |
|
322 |
|
323 | args[ 0 ] = event;
|
324 |
|
325 | for ( i = 1; i < arguments.length; i++ ) {
|
326 | args[ i ] = arguments[ i ];
|
327 | }
|
328 |
|
329 | event.delegateTarget = this;
|
330 |
|
331 |
|
332 | if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
|
333 | return;
|
334 | }
|
335 |
|
336 |
|
337 | handlerQueue = jQuery.event.handlers.call( this, event, handlers );
|
338 |
|
339 |
|
340 | i = 0;
|
341 | while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
|
342 | event.currentTarget = matched.elem;
|
343 |
|
344 | j = 0;
|
345 | while ( ( handleObj = matched.handlers[ j++ ] ) &&
|
346 | !event.isImmediatePropagationStopped() ) {
|
347 |
|
348 |
|
349 |
|
350 | if ( !event.rnamespace || handleObj.namespace === false ||
|
351 | event.rnamespace.test( handleObj.namespace ) ) {
|
352 |
|
353 | event.handleObj = handleObj;
|
354 | event.data = handleObj.data;
|
355 |
|
356 | ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
|
357 | handleObj.handler ).apply( matched.elem, args );
|
358 |
|
359 | if ( ret !== undefined ) {
|
360 | if ( ( event.result = ret ) === false ) {
|
361 | event.preventDefault();
|
362 | event.stopPropagation();
|
363 | }
|
364 | }
|
365 | }
|
366 | }
|
367 | }
|
368 |
|
369 |
|
370 | if ( special.postDispatch ) {
|
371 | special.postDispatch.call( this, event );
|
372 | }
|
373 |
|
374 | return event.result;
|
375 | },
|
376 |
|
377 | handlers: function( event, handlers ) {
|
378 | var i, handleObj, sel, matchedHandlers, matchedSelectors,
|
379 | handlerQueue = [],
|
380 | delegateCount = handlers.delegateCount,
|
381 | cur = event.target;
|
382 |
|
383 |
|
384 | if ( delegateCount &&
|
385 |
|
386 |
|
387 |
|
388 | cur.nodeType &&
|
389 |
|
390 |
|
391 |
|
392 |
|
393 |
|
394 |
|
395 | !( event.type === "click" && event.button >= 1 ) ) {
|
396 |
|
397 | for ( ; cur !== this; cur = cur.parentNode || this ) {
|
398 |
|
399 |
|
400 |
|
401 | if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
|
402 | matchedHandlers = [];
|
403 | matchedSelectors = {};
|
404 | for ( i = 0; i < delegateCount; i++ ) {
|
405 | handleObj = handlers[ i ];
|
406 |
|
407 |
|
408 | sel = handleObj.selector + " ";
|
409 |
|
410 | if ( matchedSelectors[ sel ] === undefined ) {
|
411 | matchedSelectors[ sel ] = handleObj.needsContext ?
|
412 | jQuery( sel, this ).index( cur ) > -1 :
|
413 | jQuery.find( sel, this, null, [ cur ] ).length;
|
414 | }
|
415 | if ( matchedSelectors[ sel ] ) {
|
416 | matchedHandlers.push( handleObj );
|
417 | }
|
418 | }
|
419 | if ( matchedHandlers.length ) {
|
420 | handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
|
421 | }
|
422 | }
|
423 | }
|
424 | }
|
425 |
|
426 |
|
427 | cur = this;
|
428 | if ( delegateCount < handlers.length ) {
|
429 | handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
|
430 | }
|
431 |
|
432 | return handlerQueue;
|
433 | },
|
434 |
|
435 | addProp: function( name, hook ) {
|
436 | Object.defineProperty( jQuery.Event.prototype, name, {
|
437 | enumerable: true,
|
438 | configurable: true,
|
439 |
|
440 | get: isFunction( hook ) ?
|
441 | function() {
|
442 | if ( this.originalEvent ) {
|
443 | return hook( this.originalEvent );
|
444 | }
|
445 | } :
|
446 | function() {
|
447 | if ( this.originalEvent ) {
|
448 | return this.originalEvent[ name ];
|
449 | }
|
450 | },
|
451 |
|
452 | set: function( value ) {
|
453 | Object.defineProperty( this, name, {
|
454 | enumerable: true,
|
455 | configurable: true,
|
456 | writable: true,
|
457 | value: value
|
458 | } );
|
459 | }
|
460 | } );
|
461 | },
|
462 |
|
463 | fix: function( originalEvent ) {
|
464 | return originalEvent[ jQuery.expando ] ?
|
465 | originalEvent :
|
466 | new jQuery.Event( originalEvent );
|
467 | },
|
468 |
|
469 | special: {
|
470 | load: {
|
471 |
|
472 |
|
473 | noBubble: true
|
474 | },
|
475 | click: {
|
476 |
|
477 |
|
478 | setup: function( data ) {
|
479 |
|
480 |
|
481 |
|
482 | var el = this || data;
|
483 |
|
484 |
|
485 | if ( rcheckableType.test( el.type ) &&
|
486 | el.click && nodeName( el, "input" ) ) {
|
487 |
|
488 |
|
489 | leverageNative( el, "click", returnTrue );
|
490 | }
|
491 |
|
492 |
|
493 | return false;
|
494 | },
|
495 | trigger: function( data ) {
|
496 |
|
497 |
|
498 |
|
499 | var el = this || data;
|
500 |
|
501 |
|
502 | if ( rcheckableType.test( el.type ) &&
|
503 | el.click && nodeName( el, "input" ) ) {
|
504 |
|
505 | leverageNative( el, "click" );
|
506 | }
|
507 |
|
508 |
|
509 | return true;
|
510 | },
|
511 |
|
512 |
|
513 |
|
514 | _default: function( event ) {
|
515 | var target = event.target;
|
516 | return rcheckableType.test( target.type ) &&
|
517 | target.click && nodeName( target, "input" ) &&
|
518 | dataPriv.get( target, "click" ) ||
|
519 | nodeName( target, "a" );
|
520 | }
|
521 | },
|
522 |
|
523 | beforeunload: {
|
524 | postDispatch: function( event ) {
|
525 |
|
526 |
|
527 |
|
528 | if ( event.result !== undefined && event.originalEvent ) {
|
529 | event.originalEvent.returnValue = event.result;
|
530 | }
|
531 | }
|
532 | }
|
533 | }
|
534 | };
|
535 |
|
536 |
|
537 |
|
538 |
|
539 |
|
540 | function leverageNative( el, type, expectSync ) {
|
541 |
|
542 |
|
543 | if ( !expectSync ) {
|
544 | if ( dataPriv.get( el, type ) === undefined ) {
|
545 | jQuery.event.add( el, type, returnTrue );
|
546 | }
|
547 | return;
|
548 | }
|
549 |
|
550 |
|
551 | dataPriv.set( el, type, false );
|
552 | jQuery.event.add( el, type, {
|
553 | namespace: false,
|
554 | handler: function( event ) {
|
555 | var notAsync, result,
|
556 | saved = dataPriv.get( this, type );
|
557 |
|
558 | if ( ( event.isTrigger & 1 ) && this[ type ] ) {
|
559 |
|
560 |
|
561 |
|
562 |
|
563 | if ( !saved.length ) {
|
564 |
|
565 |
|
566 |
|
567 |
|
568 | saved = slice.call( arguments );
|
569 | dataPriv.set( this, type, saved );
|
570 |
|
571 |
|
572 |
|
573 |
|
574 | notAsync = expectSync( this, type );
|
575 | this[ type ]();
|
576 | result = dataPriv.get( this, type );
|
577 | if ( saved !== result || notAsync ) {
|
578 | dataPriv.set( this, type, false );
|
579 | } else {
|
580 | result = {};
|
581 | }
|
582 | if ( saved !== result ) {
|
583 |
|
584 |
|
585 | event.stopImmediatePropagation();
|
586 | event.preventDefault();
|
587 | return result.value;
|
588 | }
|
589 |
|
590 |
|
591 |
|
592 |
|
593 |
|
594 |
|
595 |
|
596 | } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
|
597 | event.stopPropagation();
|
598 | }
|
599 |
|
600 |
|
601 |
|
602 | } else if ( saved.length ) {
|
603 |
|
604 |
|
605 | dataPriv.set( this, type, {
|
606 | value: jQuery.event.trigger(
|
607 |
|
608 |
|
609 |
|
610 | jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
|
611 | saved.slice( 1 ),
|
612 | this
|
613 | )
|
614 | } );
|
615 |
|
616 |
|
617 | event.stopImmediatePropagation();
|
618 | }
|
619 | }
|
620 | } );
|
621 | }
|
622 |
|
623 | jQuery.removeEvent = function( elem, type, handle ) {
|
624 |
|
625 |
|
626 | if ( elem.removeEventListener ) {
|
627 | elem.removeEventListener( type, handle );
|
628 | }
|
629 | };
|
630 |
|
631 | jQuery.Event = function( src, props ) {
|
632 |
|
633 |
|
634 | if ( !( this instanceof jQuery.Event ) ) {
|
635 | return new jQuery.Event( src, props );
|
636 | }
|
637 |
|
638 |
|
639 | if ( src && src.type ) {
|
640 | this.originalEvent = src;
|
641 | this.type = src.type;
|
642 |
|
643 |
|
644 |
|
645 | this.isDefaultPrevented = src.defaultPrevented ||
|
646 | src.defaultPrevented === undefined &&
|
647 |
|
648 |
|
649 | src.returnValue === false ?
|
650 | returnTrue :
|
651 | returnFalse;
|
652 |
|
653 |
|
654 |
|
655 |
|
656 | this.target = ( src.target && src.target.nodeType === 3 ) ?
|
657 | src.target.parentNode :
|
658 | src.target;
|
659 |
|
660 | this.currentTarget = src.currentTarget;
|
661 | this.relatedTarget = src.relatedTarget;
|
662 |
|
663 |
|
664 | } else {
|
665 | this.type = src;
|
666 | }
|
667 |
|
668 |
|
669 | if ( props ) {
|
670 | jQuery.extend( this, props );
|
671 | }
|
672 |
|
673 |
|
674 | this.timeStamp = src && src.timeStamp || Date.now();
|
675 |
|
676 |
|
677 | this[ jQuery.expando ] = true;
|
678 | };
|
679 |
|
680 |
|
681 |
|
682 | jQuery.Event.prototype = {
|
683 | constructor: jQuery.Event,
|
684 | isDefaultPrevented: returnFalse,
|
685 | isPropagationStopped: returnFalse,
|
686 | isImmediatePropagationStopped: returnFalse,
|
687 | isSimulated: false,
|
688 |
|
689 | preventDefault: function() {
|
690 | var e = this.originalEvent;
|
691 |
|
692 | this.isDefaultPrevented = returnTrue;
|
693 |
|
694 | if ( e && !this.isSimulated ) {
|
695 | e.preventDefault();
|
696 | }
|
697 | },
|
698 | stopPropagation: function() {
|
699 | var e = this.originalEvent;
|
700 |
|
701 | this.isPropagationStopped = returnTrue;
|
702 |
|
703 | if ( e && !this.isSimulated ) {
|
704 | e.stopPropagation();
|
705 | }
|
706 | },
|
707 | stopImmediatePropagation: function() {
|
708 | var e = this.originalEvent;
|
709 |
|
710 | this.isImmediatePropagationStopped = returnTrue;
|
711 |
|
712 | if ( e && !this.isSimulated ) {
|
713 | e.stopImmediatePropagation();
|
714 | }
|
715 |
|
716 | this.stopPropagation();
|
717 | }
|
718 | };
|
719 |
|
720 |
|
721 | jQuery.each( {
|
722 | altKey: true,
|
723 | bubbles: true,
|
724 | cancelable: true,
|
725 | changedTouches: true,
|
726 | ctrlKey: true,
|
727 | detail: true,
|
728 | eventPhase: true,
|
729 | metaKey: true,
|
730 | pageX: true,
|
731 | pageY: true,
|
732 | shiftKey: true,
|
733 | view: true,
|
734 | "char": true,
|
735 | code: true,
|
736 | charCode: true,
|
737 | key: true,
|
738 | keyCode: true,
|
739 | button: true,
|
740 | buttons: true,
|
741 | clientX: true,
|
742 | clientY: true,
|
743 | offsetX: true,
|
744 | offsetY: true,
|
745 | pointerId: true,
|
746 | pointerType: true,
|
747 | screenX: true,
|
748 | screenY: true,
|
749 | targetTouches: true,
|
750 | toElement: true,
|
751 | touches: true,
|
752 |
|
753 | which: function( event ) {
|
754 | var button = event.button;
|
755 |
|
756 |
|
757 | if ( event.which == null && rkeyEvent.test( event.type ) ) {
|
758 | return event.charCode != null ? event.charCode : event.keyCode;
|
759 | }
|
760 |
|
761 |
|
762 | if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
|
763 | if ( button & 1 ) {
|
764 | return 1;
|
765 | }
|
766 |
|
767 | if ( button & 2 ) {
|
768 | return 3;
|
769 | }
|
770 |
|
771 | if ( button & 4 ) {
|
772 | return 2;
|
773 | }
|
774 |
|
775 | return 0;
|
776 | }
|
777 |
|
778 | return event.which;
|
779 | }
|
780 | }, jQuery.event.addProp );
|
781 |
|
782 | jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
|
783 | jQuery.event.special[ type ] = {
|
784 |
|
785 |
|
786 | setup: function() {
|
787 |
|
788 |
|
789 |
|
790 |
|
791 | leverageNative( this, type, expectSync );
|
792 |
|
793 |
|
794 | return false;
|
795 | },
|
796 | trigger: function() {
|
797 |
|
798 |
|
799 | leverageNative( this, type );
|
800 |
|
801 |
|
802 | return true;
|
803 | },
|
804 |
|
805 | delegateType: delegateType
|
806 | };
|
807 | } );
|
808 |
|
809 |
|
810 |
|
811 |
|
812 |
|
813 |
|
814 |
|
815 |
|
816 |
|
817 | jQuery.each( {
|
818 | mouseenter: "mouseover",
|
819 | mouseleave: "mouseout",
|
820 | pointerenter: "pointerover",
|
821 | pointerleave: "pointerout"
|
822 | }, function( orig, fix ) {
|
823 | jQuery.event.special[ orig ] = {
|
824 | delegateType: fix,
|
825 | bindType: fix,
|
826 |
|
827 | handle: function( event ) {
|
828 | var ret,
|
829 | target = this,
|
830 | related = event.relatedTarget,
|
831 | handleObj = event.handleObj;
|
832 |
|
833 |
|
834 |
|
835 | if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
|
836 | event.type = handleObj.origType;
|
837 | ret = handleObj.handler.apply( this, arguments );
|
838 | event.type = fix;
|
839 | }
|
840 | return ret;
|
841 | }
|
842 | };
|
843 | } );
|
844 |
|
845 | jQuery.fn.extend( {
|
846 |
|
847 | on: function( types, selector, data, fn ) {
|
848 | return on( this, types, selector, data, fn );
|
849 | },
|
850 | one: function( types, selector, data, fn ) {
|
851 | return on( this, types, selector, data, fn, 1 );
|
852 | },
|
853 | off: function( types, selector, fn ) {
|
854 | var handleObj, type;
|
855 | if ( types && types.preventDefault && types.handleObj ) {
|
856 |
|
857 |
|
858 | handleObj = types.handleObj;
|
859 | jQuery( types.delegateTarget ).off(
|
860 | handleObj.namespace ?
|
861 | handleObj.origType + "." + handleObj.namespace :
|
862 | handleObj.origType,
|
863 | handleObj.selector,
|
864 | handleObj.handler
|
865 | );
|
866 | return this;
|
867 | }
|
868 | if ( typeof types === "object" ) {
|
869 |
|
870 |
|
871 | for ( type in types ) {
|
872 | this.off( type, selector, types[ type ] );
|
873 | }
|
874 | return this;
|
875 | }
|
876 | if ( selector === false || typeof selector === "function" ) {
|
877 |
|
878 |
|
879 | fn = selector;
|
880 | selector = undefined;
|
881 | }
|
882 | if ( fn === false ) {
|
883 | fn = returnFalse;
|
884 | }
|
885 | return this.each( function() {
|
886 | jQuery.event.remove( this, types, fn, selector );
|
887 | } );
|
888 | }
|
889 | } );
|
890 |
|
891 | return jQuery;
|
892 | } );
|