Opened 11 years ago

Closed 11 years ago

#8450 closed defect (wontfix)

Faux mouseenter/leave events misreport type

Reported by: dante Owned by: sjmiles
Priority: high Milestone: tbd
Component: Events Version: 1.2.3
Keywords: Cc:
Blocked By: Blocking:

Description

Feel free to close this as wontfix, it is not of a high priority:

We synthesize the mouseenter and mouseleave events in non-IE browsers because they are useful, though in all browsers their e.type remains unmodified, making delegating functions between enter/leave difficult in a cross browser way.

attached is a test case illustrating four connections on a node, and throw console message when e.type !== the original connected event. enter/leave report as over/out (though at the 'right times' as expected) in non-IE browsers, making something like:

var doit = function(e){
    dojo[(e.type == "mouseenter" ? "addClass" : "removeClass"](e.target, c);
}

tedious (as if you were to use mouseover/out in the condition, IE would fail to act. I have this workaround locally:

var janky = "mouse" + d.isIE ? "enter" : "over", 
    doit = function(e){
        dojo[(e.type == janky ? "addClass" : "removeClass")](n, c);
    };

It seems like the faux event should be modified to have a type of .mouseenter/leave in all browsers, to avoid confusion with checking against potential mouseover usages.

Attachments (1)

mouseall.html (888 bytes) - added by dante 11 years ago.

Download all attachments as: .zip

Change History (3)

Changed 11 years ago by dante

Attachment: mouseall.html added

comment:1 Changed 11 years ago by bill

That would definitely be nice, but the thing is that the event object being passed to the user's handler is the actual event object from the browser's mouseover/mouseout event, and according to the comment in the events.js we can't modify e.type:

// e.type = oname; // FIXME: doesn't take? SJM: event.type is generally immutable.

So changing this would require creating a synthetic event object, maybe something like:

e = dojo.delegate(e, {type: "mouseenter"});

comment:2 Changed 11 years ago by dante

Resolution: wontfix
Status: newclosed

type in immutable, and it might not be worth the overhead. reopen if you disagree.

Note: See TracTickets for help on using tickets.