Opened 12 years ago
Closed 12 years ago
#7711 closed bug (invalid)
last, first bad cached
Reported by: | anonymous | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | 1.6 |
Component: | unfiled | Version: | 1.4.4 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
var questor = $("td"); var obj = questor.last(".class1"); var objRet2 = questor.last(".class2"); /*bug return cached result obj*/
same with selector first;
Note: See
TracTickets for help on using
tickets.
Thanks for taking the time to contribute to the jQuery project by writing a bug report. After checking your report I come to the conclusion that this is no bug in jQuery but rather a misunderstanding on what
.last()
does.The documentation for last() says:
Also the api is specified as
.last()
(note how there is no parameter to this method, the same holds for.first()
).So as you can see from the documentation the
last()
method doesn't accept any parameters it just returns a new jQuery object containing exactly one element (the last one from the set of the jQuery object you call it on). This is way you get the same result twice, the two calls are identical as the parameter gets ignored.live test case