Side navigation
#14161 closed feature (notabug)
Opened July 20, 2013 10:39PM UTC
Closed July 22, 2013 04:10PM UTC
:nth() selector - removal plans?
Reported by: | dsg4@kent.ac.uk | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.10.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
There was recently a question (the first of its kind) asked about the little-known :nth() selector, used in the sizzle.js engine, which I answered.
Link to said question here - http://stackoverflow.com/questions/17382703/what-is-the-nth-pseudo-class-selector-in-jquery.
As you'll see in my answer, I included an old mailing list conversation regarding the difference between the two, and when both selectors were pointed out to be equal, John Resig responded: "Huh... I should probably nuke :nth().".
Link to said mailing list conversation here - http://www.mail-archive.com/jquery-en@googlegroups.com/msg13567.html.
I'm a little confused as to why :nth() has still not been removed considering it is seemingly exactly the same as :eq(). Are there any plans to remove it in the future? If not, why?
Side query: It appears a jsPerf was made to compare and confirm the two selectors were exactly the same; all's well when tested in desktop browsers, however there seems to be differences in speed in mobile browsers - surely those tests just anomalies? or is there anything behind it?
Link to said jsPerf - http://jsperf.com/eq-vs-nth
Attachments (0)
Change History (2)
Changed July 21, 2013 06:01PM UTC by comment:1
Changed July 22, 2013 04:10PM UTC by comment:2
resolution: | → notabug |
---|---|
status: | new → closed |
It's just an alias. It's not documented by jQuery (because there's :eq), but it's documented by Sizzle.
That jsperf shows there isn't any real difference. Don't get hung up on small differences.
It doesn't really buy us anything in size or performance to remove
:nth
so I'd be inclined to leave it in. All we'll end up doing is breaking someone's code.Right now
:nth
doesn't seem to be documented, it would be worth adding an entry so that we can add the warnings used in all jQuery selector extensions.