Side navigation
#4655 closed bug (invalid)
Opened May 13, 2009 09:21AM UTC
Closed May 14, 2009 12:11AM UTC
is function wrong with :first, :last, :last-child
Reported by: | tigerf | Owned by: | john |
---|---|---|---|
Priority: | major | Milestone: | 1.4 |
Component: | selector | Version: | 1.3.2 |
Keywords: | is last first | Cc: | |
Blocked by: | Blocking: |
Description
I have some code that result is not match expectation.
html:
<span>1</span><span>2</span><span>3</span>
script:
$('span:eq(0)').is('span:first') // yes, it is true $('span:eq(2)').is('span:first') // expect false but true $('span:eq(2)').is('span:last') // yes, it is true $('span:eq(0)').is('span:last') // expect false but true $('span:eq(0)').is('span:first-child') // yes, it is true $('span:eq(2)').is('span:first-child') // yes, it is false $('span:eq(2)').is('span:last-child') // expect true but false $('span:eq(0)').is('span:last-child') // yes, it is false
BTW: I don't know what is different between :first and :first-child.
Attachments (0)
Change History (1)
Changed May 14, 2009 12:11AM UTC by comment:1
resolution: | → invalid |
---|---|
status: | new → closed |
These are good things to explore with other users in a forum. Please don't file a bug report until you are sure it's a bug.
The
method takes its context from the collection of nodes it is given, similar to . (The docs note this relationship.) If the filter expression yields at least one element, returns true.Your examples are all selecting a single span, so
and will be true. You aren't showing the complete markup, so I don't know whether the should return true or false.