Skip to main content

Bug Tracker

Side navigation

#9561 closed bug (invalid)

Opened June 11, 2011 06:07AM UTC

Closed June 11, 2011 07:19PM UTC

Last modified June 13, 2011 05:45AM UTC

Bug with multiple class selector

Reported by: kailhuang@live.cn Owned by:
Priority: undecided Milestone: 1.next
Component: unfiled Version: 1.6.1
Keywords: Cc:
Blocked by: Blocking:
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

Attachments (0)
Change History (4)

Changed June 11, 2011 07:19PM UTC by dmethvin comment:1

resolution: → invalid
status: newclosed

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

Changed June 12, 2011 01:28PM UTC by anonymous comment:2

??? 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.

Changed June 13, 2011 05:39AM UTC by ajpiano comment:3

.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."

Changed June 13, 2011 05:45AM UTC by anonymous comment:4

ok, if the only case that the selector property would be used is in the .live() func, it should be fine to ignore this issue. But what if there's anything else other than .live() that has dependency on the selector property, don't you consider it as valid?