Opened 11 years ago
Closed 11 years ago
#8573 closed bug (wontfix)
Using a jQuery selections function as an eventHandler confuses jQuery.
Reported by: | kitsunde | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | 1.next |
Component: | core | Version: | 1.5.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
$("button").live("click", $("div").hide );
Results in an error: Chrome 11 dev: #<HTMLButtonElement> has no method 'animate' Firefox 3.6: this.animate is not a function
Indicating that the hide call is being executed on the "button" selection rather than the "div" selection.
Test case: http://jsfiddle.net/bLAvM/
I've also tested in jQuery 1.3.2 which gives the same problem, and I've attempted to use $("button").click instead of .live with the same exception.
Change History (1)
comment:1 Changed 11 years ago by
Component: | unfiled → core |
---|---|
Priority: | undecided → low |
Resolution: | → wontfix |
Status: | new → closed |
Note: See
TracTickets for help on using
tickets.
Replying to kitsunde:
This happens because jQuery manages scope for callbacks in an unorthodox, yet consistent manner and all it sees you passing is a function definition, to which it will coerce the scope into whatever the calling selector set was.