Skip to content

Commit

Permalink
Do not sniff when testing for IE's proprietary mouseenter/mouseleave …
Browse files Browse the repository at this point in the history
…events support. Use more robust inference instead.
  • Loading branch information
Juriy Zaytsev committed Mar 28, 2009
1 parent fd46f6b commit c480bd7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
* Do not sniff when testing for IE's proprietary mouseenter/mouseleave events support. Use more robust inference instead. (kangax)

* Use `Prototype.emptyFunction` consistently throughout unit tests. [#253 state:resolved] (Michael M Slusarz, John David Dalton, kangax)

* deprecation extension: mark Array#reduce() as removed. [#569 state:resolved] (Tobie Langel)
Expand Down
8 changes: 6 additions & 2 deletions src/dom/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@

cache: {}
};

var docEl = document.documentElement;
var MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED = 'onmouseenter' in docEl
&& 'onmouseleave' in docEl;

var _isButton;
if (Prototype.Browser.IE) {
Expand Down Expand Up @@ -320,7 +324,7 @@
};
} else {
// Non-custom event.
if (!Prototype.Browser.IE &&
if (!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED &&
(eventName === "mouseenter" || eventName === "mouseleave")) {
// If we're dealing with mouseenter or mouseleave in a non-IE browser,
// we create a custom responder that mimics their behavior within
Expand Down Expand Up @@ -376,7 +380,7 @@

var _getDOMEventName = Prototype.K;

if (!Prototype.Browser.IE) {
if (!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED) {
_getDOMEventName = function(eventName) {
var translations = { mouseenter: "mouseover", mouseleave: "mouseout" };
return eventName in translations ? translations[eventName] : eventName;
Expand Down

0 comments on commit c480bd7

Please sign in to comment.