| @@ 5186-5244 (lines=59) @@ | ||
| 5183 | return event.result; |
|
| 5184 | }, |
|
| 5185 | ||
| 5186 | dispatch: function( event ) { |
|
| 5187 | ||
| 5188 | // Make a writable jQuery.Event from the native event object |
|
| 5189 | event = jQuery.event.fix( event ); |
|
| 5190 | ||
| 5191 | var i, j, ret, matched, handleObj, |
|
| 5192 | handlerQueue = [], |
|
| 5193 | args = slice.call( arguments ), |
|
| 5194 | handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], |
|
| 5195 | special = jQuery.event.special[ event.type ] || {}; |
|
| 5196 | ||
| 5197 | // Use the fix-ed jQuery.Event rather than the (read-only) native event |
|
| 5198 | args[ 0 ] = event; |
|
| 5199 | event.delegateTarget = this; |
|
| 5200 | ||
| 5201 | // Call the preDispatch hook for the mapped type, and let it bail if desired |
|
| 5202 | if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { |
|
| 5203 | return; |
|
| 5204 | } |
|
| 5205 | ||
| 5206 | // Determine handlers |
|
| 5207 | handlerQueue = jQuery.event.handlers.call( this, event, handlers ); |
|
| 5208 | ||
| 5209 | // Run delegates first; they may want to stop propagation beneath us |
|
| 5210 | i = 0; |
|
| 5211 | while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { |
|
| 5212 | event.currentTarget = matched.elem; |
|
| 5213 | ||
| 5214 | j = 0; |
|
| 5215 | while ( ( handleObj = matched.handlers[ j++ ] ) && |
|
| 5216 | !event.isImmediatePropagationStopped() ) { |
|
| 5217 | ||
| 5218 | // Triggered event must either 1) have no namespace, or 2) have namespace(s) |
|
| 5219 | // a subset or equal to those in the bound event (both can have no namespace). |
|
| 5220 | if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) { |
|
| 5221 | ||
| 5222 | event.handleObj = handleObj; |
|
| 5223 | event.data = handleObj.data; |
|
| 5224 | ||
| 5225 | ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || |
|
| 5226 | handleObj.handler ).apply( matched.elem, args ); |
|
| 5227 | ||
| 5228 | if ( ret !== undefined ) { |
|
| 5229 | if ( ( event.result = ret ) === false ) { |
|
| 5230 | event.preventDefault(); |
|
| 5231 | event.stopPropagation(); |
|
| 5232 | } |
|
| 5233 | } |
|
| 5234 | } |
|
| 5235 | } |
|
| 5236 | } |
|
| 5237 | ||
| 5238 | // Call the postDispatch hook for the mapped type |
|
| 5239 | if ( special.postDispatch ) { |
|
| 5240 | special.postDispatch.call( this, event ); |
|
| 5241 | } |
|
| 5242 | ||
| 5243 | return event.result; |
|
| 5244 | }, |
|
| 5245 | ||
| 5246 | handlers: function( event, handlers ) { |
|
| 5247 | var i, matches, sel, handleObj, |
|
| @@ 4692-4750 (lines=59) @@ | ||
| 4689 | } |
|
| 4690 | }, |
|
| 4691 | ||
| 4692 | dispatch: function( event ) { |
|
| 4693 | ||
| 4694 | // Make a writable jQuery.Event from the native event object |
|
| 4695 | event = jQuery.event.fix( event ); |
|
| 4696 | ||
| 4697 | var i, j, ret, matched, handleObj, |
|
| 4698 | handlerQueue = [], |
|
| 4699 | args = slice.call( arguments ), |
|
| 4700 | handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [], |
|
| 4701 | special = jQuery.event.special[ event.type ] || {}; |
|
| 4702 | ||
| 4703 | // Use the fix-ed jQuery.Event rather than the (read-only) native event |
|
| 4704 | args[ 0 ] = event; |
|
| 4705 | event.delegateTarget = this; |
|
| 4706 | ||
| 4707 | // Call the preDispatch hook for the mapped type, and let it bail if desired |
|
| 4708 | if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { |
|
| 4709 | return; |
|
| 4710 | } |
|
| 4711 | ||
| 4712 | // Determine handlers |
|
| 4713 | handlerQueue = jQuery.event.handlers.call( this, event, handlers ); |
|
| 4714 | ||
| 4715 | // Run delegates first; they may want to stop propagation beneath us |
|
| 4716 | i = 0; |
|
| 4717 | while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { |
|
| 4718 | event.currentTarget = matched.elem; |
|
| 4719 | ||
| 4720 | j = 0; |
|
| 4721 | while ( ( handleObj = matched.handlers[ j++ ] ) && |
|
| 4722 | !event.isImmediatePropagationStopped() ) { |
|
| 4723 | ||
| 4724 | // Triggered event must either 1) have no namespace, or 2) have namespace(s) |
|
| 4725 | // a subset or equal to those in the bound event (both can have no namespace). |
|
| 4726 | if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) { |
|
| 4727 | ||
| 4728 | event.handleObj = handleObj; |
|
| 4729 | event.data = handleObj.data; |
|
| 4730 | ||
| 4731 | ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || |
|
| 4732 | handleObj.handler ).apply( matched.elem, args ); |
|
| 4733 | ||
| 4734 | if ( ret !== undefined ) { |
|
| 4735 | if ( ( event.result = ret ) === false ) { |
|
| 4736 | event.preventDefault(); |
|
| 4737 | event.stopPropagation(); |
|
| 4738 | } |
|
| 4739 | } |
|
| 4740 | } |
|
| 4741 | } |
|
| 4742 | } |
|
| 4743 | ||
| 4744 | // Call the postDispatch hook for the mapped type |
|
| 4745 | if ( special.postDispatch ) { |
|
| 4746 | special.postDispatch.call( this, event ); |
|
| 4747 | } |
|
| 4748 | ||
| 4749 | return event.result; |
|
| 4750 | }, |
|
| 4751 | ||
| 4752 | handlers: function( event, handlers ) { |
|
| 4753 | var i, matches, sel, handleObj, |
|