Skip to main content

Bug Tracker

Side navigation

#11299 closed enhancement (wontfix)

Opened February 07, 2012 05:02PM UTC

Closed February 07, 2012 05:05PM UTC

Last modified February 07, 2012 06:53PM UTC

Add :is() to selectors

Reported by: wheresrhys@gmail.com Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.2b1
Keywords: Cc:
Blocked by: Blocking:
Description

I recently asked this question on stackoverflow http://stackoverflow.com/questions/9179151/getting-the-n-th-child-in-each-row-using-a-compound-selector/9179208#comment11548241_9179208

The issue boils down, I think, to not being able to use a :selector() style selector after a compound selector split with ,

e.g.

$("p, ul:eq(5)")

will return paragraphs and the fifth list but I might want to return the element which is the fifth paragraph or list

Conversely, If I want the 5th element which is not a paragraph or list I can do this because :not() conveniently wraps my compound query

$(":not(p, ul):eq(5)")

So I propose adding is:(), or even more succinctly, just () as valid selectors which cause a compound selector to be executed before the next part of the selector

$(":is(p, ul):eq(5)")

or 

$("(p, ul):eq(5)")
Attachments (0)
Change History (3)

Changed February 07, 2012 05:05PM UTC by dmethvin comment:1

resolution: → wontfix
status: newclosed

Sorry, but that takes us further from standard CSS3 selectors and we've decided that is not a good direction to take since it prevents the use of querySelectorAll and matchesSelector. If you have convincing use-cases for that kind of selector you should make it to the CSS4 working group.

Changed February 07, 2012 05:34PM UTC by wheresrhys@gmail.com comment:2

Replying to [comment:1 dmethvin]:

Sorry, but that takes us further from standard CSS3 selectors and we've decided that is not a good direction to take since it prevents the use of querySelectorAll and matchesSelector. If you have convincing use-cases for that kind of selector you should make it to the CSS4 working group.

darn!

Do you know where I might go to submit an idea? Searching google for css 4 feedback specs and similar phrases doesn't turn up any feedback forms or similar, and aside from joining the working group as an expert the w3 site doesn't make it clear how you would contribute an idea?

I've also realised that, while I wait for the CSS working group to come round to my way of thinking, I can use :not(:not())

Changed February 07, 2012 06:53PM UTC by dmethvin comment:3

They have a wiki here, you can see what has been proposed and provide feedback:

http://wiki.csswg.org/