Ticket #9561 (closed bug: invalid)
Bug with multiple class selector
| Reported by: | kailhuang@… | Owned by: | |
|---|---|---|---|
| Priority: | undecided | Milestone: | 1.next |
| Component: | unfiled | Version: | 1.6.1 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
I don't know if you had already been aware of this issue:
if you are using live to add eventHandlers, the live function relies on the selector property of JQ object. but the thing is when you are using something like $("div.class1, div.class2").find("a").live, the selector would be incorrect as "div.class1, div.class2 a" which is not as expected.
$("div.class1").find("a").selector = "div.class1 a";
$("div.class1, div.class2").find("a").selector = "div.class1, div.class2 a";
I'm not sure if it is by design or you will fix it.
anyway, jQuery is cool and thx for your efforts!
thx, Kail
Change History
comment:1 Changed 2 years ago by dmethvin
- Status changed from new to closed
- Resolution set to invalid
comment:2 Changed 2 years ago by anonymous
??? That DOES sound like a bug to me and not "invalid usage". All the docs say is that attaches "a handler to the event for all elements which match the current selector, now and in the future."
And if the current selector is built incorrectly (as it obviously is) this behavior is unexpected.
comment:3 Changed 2 years ago by ajpiano
.live() is not meant to work against anything other than a direct selector, which is why $("foo").find("bar").live() will is always considered to be an invalid usage. From the docs:
"DOM traversal methods are not supported for finding elements to send to .live(). Rather, the .live() method should always be called directly after a selector, as in the example above."
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

As the .live() docs indicate, that isn't valid usage.