Skip to content

Loading…

Fix #2089. Feature detect for mouseenter and (assume) mouseleave. #2139

Merged
merged 1 commit into from

2 participants

@ibolmo
MooTools member

TESTED: IE6-9, Chrome latest, Firefox 3-5, 8, 10, Opera 11, Safari 5

Using Element.Delegation.html.

@ibolmo ibolmo Feature detect for mouseenter and (assume) mouseleave.
TESTED: IE6-9, Chrome latest, Firefox 3-5, 8, 10, Opera 11, Safari 5

Using Element.Delegation.html.
d6b0512
@ibolmo
MooTools member

Fixes #2089.

@cpojer
MooTools member

fiiix the docs. :)

@cpojer cpojer merged commit cc89cb6 into mootools:master
@ibolmo
MooTools member

Done 74644b1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 27, 2011
  1. @ibolmo

    Feature detect for mouseenter and (assume) mouseleave.

    ibolmo committed
    TESTED: IE6-9, Chrome latest, Firefox 3-5, 8, 10, Opera 11, Safari 5
    
    Using Element.Delegation.html.
Showing with 19 additions and 19 deletions.
  1. +19 −19 Source/Element/Element.Event.js
View
38 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){
Something went wrong with that request. Please try again.