Skip to main content

Bug Tracker

Side navigation

#5208 closed bug (worksforme)

Opened September 13, 2009 04:29AM UTC

Closed November 04, 2009 03:07PM UTC

Possible bug involving :not()

Reported by: plasko Owned by: john
Priority: minor Milestone: 1.4
Component: selector Version: 1.2.6
Keywords: :not :first Cc:
Blocked by: Blocking:
Description

It seems to me that if you have 3 select lists and each have 10 options and you use this selector:

$('select:not(:first) option:first') it should return 3 elements. It only returns 1

$('select:not(:first)').find('option:first') will return 3 though.

While I'm not 100% sure you guys designed it to work, just that I expected the former (the first option of the not-first select lists) and thought you might want to know.

Attachments (0)
Change History (2)

Changed October 03, 2009 01:01AM UTC by dmethvin comment:1

Can you provide a test case with complete code and html?

Changed November 04, 2009 03:07PM UTC by davidserduke comment:2

resolution: → worksforme
status: newclosed

Looks like you thought this would return 3 elements correct? But the :first option will only return the one element that is first. You are likely thinking of :first-child which in your case would give you the first option of each of the selects that wasn't first.

$('select:not(:first) option:first-child')

http://docs.jquery.com/Selectors/firstChild

Although technically with your test case that would return 2 since you only have 3 select lists and the first one would be skipped.

In any case, please reopen if that isn't what you meant and attach a test case with code and html as Dave requested so we don't mis-interpret the problem.