Permalink
Browse files

Fix #11021. There should be no mangling of the "hover" namespace.

  • Loading branch information...
1 parent 5798eab commit 4534db196bf9475c79f74d6b62ebc866c27d06d9 @dmethvin dmethvin committed Dec 14, 2011
Showing with 6 additions and 2 deletions.
  1. +1 −1 src/event.js
  2. +5 −1 test/unit/event.js
View
@@ -2,7 +2,7 @@
var rformElems = /^(?:textarea|input|select)$/i,
rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/,
- rhoverHack = /\bhover(\.\S+)?\b/,
+ rhoverHack = /(?:^|\s)hover(\.\S+)?\b/,
rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|contextmenu)|click/,
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
View
@@ -787,7 +787,7 @@ test("unbind(eventObject)", function() {
});
test("hover() and hover pseudo-event", function() {
- expect(2);
+ expect(3);
var times = 0,
handler1 = function( event ) { ++times; },
@@ -810,6 +810,9 @@ test("hover() and hover pseudo-event", function() {
.on( "hovercraft", function() {
ok( false, "hovercraft is full of ills" );
})
+ .on( "click.hover.me.not", function( e ) {
+ equal( e.handleObj.namespace, "hover.me.not", "hover hack doesn't mangle namespaces" );
+ })
.bind("hover", function( e ) {
if ( e.type === "mouseenter" ) {
balance++;
@@ -819,6 +822,7 @@ test("hover() and hover pseudo-event", function() {
ok( false, "hover pseudo: unknown event type "+e.type );
}
})
+ .trigger("click")
.trigger("mouseenter")
.trigger("mouseleave")
.unbind("hover")

0 comments on commit 4534db1

Please sign in to comment.