aboutsummaryrefslogtreecommitdiffstats
path: root/src/event.js
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2008-12-21 21:22:44 +0000
committerJohn Resig <jeresig@gmail.com>2008-12-21 21:22:44 +0000
commitb850ab2b8e65eadd25093c81bbc67a881daa0488 (patch)
treedf385b3c4b165384f3a6c4ade60760b94db8cac4 /src/event.js
parent8ee1708ea93517f69979a6805480597b96b58da7 (diff)
downloadjquery-b850ab2b8e65eadd25093c81bbc67a881daa0488.tar.gz
jquery-b850ab2b8e65eadd25093c81bbc67a881daa0488.zip
Added the new jQuery.support object and removed all uses of jQuery.browser from within jQuery itself (while simultaneously deprecating the use of jQuery.browser).
Diffstat (limited to 'src/event.js')
-rw-r--r--src/event.js64
1 files changed, 31 insertions, 33 deletions
diff --git a/src/event.js b/src/event.js
index 662fc4848..9d0645731 100644
--- a/src/event.js
+++ b/src/event.js
@@ -13,7 +13,7 @@ jQuery.event = {
// For whatever reason, IE has trouble passing the window object
// around, causing it to be cloned in the process
- if ( jQuery.browser.msie && elem.setInterval )
+ if ( elem.setInterval && elem != window )
elem = window;
// Make sure that the function being executed has a unique ID
@@ -383,39 +383,37 @@ function stopImmediatePropagation(){
this.stopPropagation();
}
-if ( !jQuery.browser.msie ){
- // Checks if an event happened on an element within another element
- // Used in jQuery.event.special.mouseenter and mouseleave handlers
- var withinElement = function(event) {
- // Check if mouse(over|out) are still within the same parent element
- var parent = event.relatedTarget;
- // Traverse up the tree
- while ( parent && parent != this )
- try { parent = parent.parentNode; }
- catch(e) { parent = this; }
-
- if( parent != this ){
- // set the correct event type
- event.type = event.data;
- // handle event if we actually just moused on to a non sub-element
- jQuery.event.handle.apply( this, arguments );
- }
- };
+// Checks if an event happened on an element within another element
+// Used in jQuery.event.special.mouseenter and mouseleave handlers
+var withinElement = function(event) {
+ // Check if mouse(over|out) are still within the same parent element
+ var parent = event.relatedTarget;
+ // Traverse up the tree
+ while ( parent && parent != this )
+ try { parent = parent.parentNode; }
+ catch(e) { parent = this; }
- jQuery.each({
- mouseover: 'mouseenter',
- mouseout: 'mouseleave'
- }, function( orig, fix ){
- jQuery.event.special[ fix ] = {
- setup: function(){
- jQuery.event.add( this, orig, withinElement, fix );
- },
- teardown: function(){
- jQuery.event.remove( this, orig, withinElement );
- }
- };
- });
-}
+ if( parent != this ){
+ // set the correct event type
+ event.type = event.data;
+ // handle event if we actually just moused on to a non sub-element
+ jQuery.event.handle.apply( this, arguments );
+ }
+};
+
+jQuery.each({
+ mouseover: 'mouseenter',
+ mouseout: 'mouseleave'
+}, function( orig, fix ){
+ jQuery.event.special[ fix ] = {
+ setup: function(){
+ jQuery.event.add( this, orig, withinElement, fix );
+ },
+ teardown: function(){
+ jQuery.event.remove( this, orig, withinElement );
+ }
+ };
+});
jQuery.fn.extend({
bind: function( type, data, fn ) {