-
Notifications
You must be signed in to change notification settings - Fork 27.5k
fix(jqLite): change implementation of mouseenter/mouseleave event #2383
Conversation
Implement mouseenter/mouseleave event refering to http://www.quirksmode.org/js/events_mouse.html#link8 and jQuery source code(not dependent on jQuery). The old implementation is wrong. When moving mouse from a parent element into a child element, it would trigger mouseleave event, which should not. And the old test about mouseenter/mouseleave is wrong too. It just triggers mouseover and mouseout events, cannot describe the process of mouse moving from one element to another element, which is important for mouseenter/mouseleave. Closes angular#2131, angular#1811
@gockxml - shouldn't we be using the native mouseenter and mouseleave events if they are supported by the browser rather than always polyfilling? It is interesting to notice that ng-mouseenter and ng-mouseleave work as expected on browsers that support these events natively. Not sure what would happen in a browser that doesn't. Other than that, this looks good to me. |
|
Good old IE8: http://ci.angularjs.org/job/angular.js-pete/76/ |
@petebacondarwin Sorry, I didn't know that firefox and opera support native mouseleave. I just implemented the way jQuery has done. However, DOM event support detection is not quite easy and neat. On second thought, maybe always polyfilling is not that bad. :) |
@petebacondarwin I am a really newbie on github and all the open source things. And I am not a English speaker. So please forgive me to ask silly questions. I guess I need to pass the IE8 test before you can merge it? I have signed signed CLA and my real name is Zhiliang Ge. |
I'm afraid that we do need to pass on IE. |
would also be nice to add contains() to angular.element, if we're adding it in here anyway |
@gockxml - Did you get anywhere trying to get tests to pass on IE? |
Implement mouseenter/mouseleave event refering to http://www.quirksmode.org/js/events_mouse.html#link8 and jQuery source code(not dependent on jQuery). The old implementation is wrong. When moving mouse from a parent element into a child element, it would trigger mouseleave event, which should not. And the old test about mouseenter/mouseleave is wrong too. It just triggers mouseover and mouseout events, cannot describe the process of mouse moving from one element to another element, which is important for mouseenter/mouseleave.
@petebacondarwin Sorry, I spent much time on attempting to test IE in vm similar to ci.angular.org, but failed. :( Finally I decided to test and debug it in IE8 manually. Now it should pass the IE test. |
Landed as 06f2b2a. Thanks! |
@florianorben - I hear what you are saying. Do you want to create a PR for this? |
Implement mouseenter/mouseleave event refering to http://www.quirksmode.org/js/events_mouse.html#link8 and jQuery source code (not dependent on jQuery).
The old implementation is wrong. When moving mouse from a parent element into a child element, it would trigger mouseleave event, which should not.
And the old test about mouseenter/mouseleave is wrong too. It just triggers mouseover and mouseout events, cannot describe the process of mouse moving from one element to nother element, which is important for mouseenter/mouseleave.
Closes #2131, #1811