Opened 11 years ago
Closed 11 years ago
#12472 closed bug (invalid)
Window on event mouseup body selector no longer working
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.8.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
- Latest 1.8.1 (this code was working on 1.8.0, I verified it)
- Latest Chrome 21 (although my colleague informed me it is not reproducible in IE 9, but I cannot verify his claim)
- OSX 10.8
- Use the following code:
$('body').addClass('has-active-menu'); $(window).on('mouseup', 'body.has-active-menu', function () { alert('test'); });
Then click anywhere on the screen, nothing happens. You can try mousedown too, doesn't work either.
- This code worked in 1.8.0 and 1.7, it is valid code (delegation of the window/html tag to the body tag). My expectation is that alert will fire.
Note: See
TracTickets for help on using
tickets.
You should be using
document
. That is the highest point that supports delegated events. The fact that it used to work withwindow
doesn't mean it was meant to work.