Bug Tracker

Ticket #11299 (closed enhancement: wontfix)

Opened 2 years ago

Last modified 2 years ago

Add :is() to selectors

Reported by: wheresrhys@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.2b1
Keywords: Cc:
Blocking: Blocked by:

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)")

Change History

comment:1 follow-up: ↓ 2 Changed 2 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to wontfix

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.

comment:2 in reply to: ↑ 1 Changed 2 years ago by wheresrhys@…

Replying to 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())

comment:3 Changed 2 years ago by dmethvin

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

 http://wiki.csswg.org/

Note: See TracTickets for help on using tickets.