Permalink
Browse files

Merge pull request #2139 from ibolmo/fix-2089-native-mouse-enter-and-…

…leave


Fix #2089. Feature detect for mouseenter and (assume) mouseleave.
  • Loading branch information...
2 parents 2f038d4 + d6b0512 commit cc89cb6c71e1f4ca9c533da55c9775f7d7478c11 @cpojer cpojer committed Nov 27, 2011
Showing with 19 additions and 19 deletions.
  1. +19 −19 Source/Element/Element.Event.js
@@ -3,7 +3,7 @@
name: Element.Event
-description: Contains Element methods for dealing with events. This file also includes mouseenter and mouseleave custom Element Events.
+description: Contains Element methods for dealing with events. This file also includes mouseenter and mouseleave custom Element Events, if necessary.
license: MIT-style license.
@@ -141,30 +141,30 @@ Element.NativeEvents = {
error: 1, abort: 1, scroll: 1 //misc
};
-var check = function(event){
- var related = event.relatedTarget;
- if (related == null) return true;
- if (!related) return false;
- return (related != this && related.prefix != 'xul' && typeOf(this) != 'document' && !this.contains(related));
-};
-
-Element.Events = {
+Element.Events = {mousewheel: {
+ base: (Browser.firefox) ? 'DOMMouseScroll' : 'mousewheel'
+}};
- mouseenter: {
+if ('onmouseenter' in document.documentElement){
+ Element.NativeEvents.mouseenter = Element.NativeEvents.mouseleave = 2;
+} else {
+ var check = function(event){
+ var related = event.relatedTarget;
+ if (related == null) return true;
+ if (!related) return false;
+ return (related != this && related.prefix != 'xul' && typeOf(this) != 'document' && !this.contains(related));
+ };
+
+ Element.Events.mouseenter = {
base: 'mouseover',
condition: check
- },
+ };
- mouseleave: {
+ Element.Events.mouseleave = {
base: 'mouseout',
condition: check
- },
-
- mousewheel: {
- base: (Browser.firefox) ? 'DOMMouseScroll' : 'mousewheel'
- }
-
-};
+ };
+}
/*<ltIE9>*/
if (!window.addEventListener){

0 comments on commit cc89cb6

Please sign in to comment.