aboutsummaryrefslogtreecommitdiffstats
path: root/src/event.js
diff options
context:
space:
mode:
authorDave Methvin <dave.methvin@gmail.com>2012-12-26 16:47:31 -0500
committerDave Methvin <dave.methvin@gmail.com>2012-12-26 16:47:31 -0500
commit97fa97f0c1cd6a14a0d7f5e2599b30c502bd3e8c (patch)
tree38e5bb4b2833c641fe7642450b82a84bd762be75 /src/event.js
parent1c4297816dc274754d399e9e66e0bbf39f4d008a (diff)
downloadjquery-97fa97f0c1cd6a14a0d7f5e2599b30c502bd3e8c.tar.gz
jquery-97fa97f0c1cd6a14a0d7f5e2599b30c502bd3e8c.zip
Remove oldIE proprietary event methods/properties.
Diffstat (limited to 'src/event.js')
-rw-r--r--src/event.js52
1 files changed, 9 insertions, 43 deletions
diff --git a/src/event.js b/src/event.js
index 41ec7d165..6c6a51678 100644
--- a/src/event.js
+++ b/src/event.js
@@ -86,14 +86,10 @@ jQuery.event = {
handlers = events[ type ] = [];
handlers.delegateCount = 0;
- // Only use addEventListener/attachEvent if the special events handler returns false
+ // Only use addEventListener if the special events handler returns false
if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
- // Bind the global event handler to the element
if ( elem.addEventListener ) {
elem.addEventListener( type, eventHandle, false );
-
- } else if ( elem.attachEvent ) {
- elem.attachEvent( "on" + type, eventHandle );
}
}
}
@@ -580,26 +576,11 @@ jQuery.event = {
// The 1.7 special event interface should provide all the hooks needed now.
jQuery.event.handle = jQuery.event.dispatch;
-jQuery.removeEvent = document.removeEventListener ?
- function( elem, type, handle ) {
- if ( elem.removeEventListener ) {
- elem.removeEventListener( type, handle, false );
- }
- } :
- function( elem, type, handle ) {
- var name = "on" + type;
-
- if ( elem.detachEvent ) {
-
- // #8545, #7054, preventing memory leaks for custom events in IE6-8
- // detachEvent needed property on element, by name of that event, to properly expose it to GC
- if ( typeof elem[ name ] === "undefined" ) {
- elem[ name ] = null;
- }
-
- elem.detachEvent( name, handle );
- }
- };
+jQuery.removeEvent = function( elem, type, handle ) {
+ if ( elem.removeEventListener ) {
+ elem.removeEventListener( type, handle, false );
+ }
+};
jQuery.Event = function( src, props ) {
// Allow instantiation without the 'new' keyword
@@ -614,7 +595,7 @@ jQuery.Event = function( src, props ) {
// Events bubbling up the document may have been marked as prevented
// by a handler lower down the tree; reflect the correct value.
- this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
+ this.isDefaultPrevented = ( src.defaultPrevented ||
src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
// Event type
@@ -648,32 +629,17 @@ jQuery.Event.prototype = {
this.isDefaultPrevented = returnTrue;
var e = this.originalEvent;
- if ( !e ) {
- return;
- }
-
- // if preventDefault exists run it on the original event
- if ( e.preventDefault ) {
+ if ( e && e.preventDefault ) {
e.preventDefault();
-
- // otherwise set the returnValue property of the original event to false (IE)
- } else {
- e.returnValue = false;
}
},
stopPropagation: function() {
this.isPropagationStopped = returnTrue;
var e = this.originalEvent;
- if ( !e ) {
- return;
- }
- // if stopPropagation exists run it on the original event
- if ( e.stopPropagation ) {
+ if ( e && e.stopPropagation ) {
e.stopPropagation();
}
- // otherwise set the cancelBubble property of the original event to true (IE)
- e.cancelBubble = true;
},
stopImmediatePropagation: function() {
this.isImmediatePropagationStopped = returnTrue;