Bug Tracker

Modify

Ticket #9561 (closed bug: invalid)

Opened 2 years ago

Last modified 2 years ago

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

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

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

comment:4 Changed 2 years ago by anonymous

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?

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.