Opened 11 years ago
Closed 11 years ago
#11552 closed feature (duplicate)
Add support for :nth-of-type()
Reported by: | wenz | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | 1.next |
Component: | selector | Version: | 1.7.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
The :nth-of-type CSS selector has been removed in jQuery 1.0. Given that recent browsers do support querySelector() and thus also support :nth-of-type(), I believe it would be a good idea to add :nth-of-type for legacy browsers. For instance, the example at http://jsfiddle.net/Kr5yN/3/ works in all current browsers and IE9+, but fails in IE6-8.
Change History (5)
comment:1 Changed 11 years ago by
Component: | unfiled → selector |
---|---|
Priority: | undecided → low |
comment:2 Changed 11 years ago by
Seems like a rare selector need to me. If you're in a situation where all the platforms you support provide querySelectorAll
you can use it.
Since this is really a Sizzle issue, I'll leave it open for timmywil's call.
comment:3 Changed 11 years ago by
Milestone: | None → 1.next |
---|---|
Status: | new → open |
I'm ok with adding it, but I think we should do some voting. There wouldn't be much extra bloat since we can reuse :nth-child's argument parsing, which has the same syntax.
comment:4 Changed 11 years ago by
I'm okay with it if it's only a few bytes, since it's a cross-browser issue.
comment:5 Changed 11 years ago by
Resolution: | → duplicate |
---|---|
Status: | open → closed |
This issue has been ported to a more widespread sizzle issue: https://github.com/jquery/sizzle/issues/44
Nothing has changed since it was removed. A fallback for legacy browsers is still needed, and it's still a pretty obscure selector, and not worth the extra bloat. In most cases nth-child can be used instead.
If you really need it with jQuery, you can use this plugin: https://github.com/keithclark/JQuery-Extended-Selectors or this: http://css-tricks.com/snippets/jquery/add-nth-of-type-to-jquery/
Reasoning: http://ejohn.org/blog/selectors-that-people-actually-use/