I acknowledge that it must be tough working on the CSS standard, and it's a job that I'm glad I don't have. But understanding and using CSS is hard enough without examples like this:
This opens up a great deal of new ways to match
content. For instance, a developer can match all
paragraphs that contain nothing but images:
// Match a paragraph that does not have anything that is not an image
p:not(:has(:not(img))):not(:empty)
You don't start introducing :has with a convoluted multi-negative example like that. You save that for after the reader understands what :has does, to demonstrate how it lets you do really complex expressions that you couldn't do before. Or maybe you don't bother with that at all, since it's probably a rare case, and the much more common case that you should emphasize is that :has lets you style an element based on the children it contains, which CSS doesn't let you do today.
And what does this mean?
Caveat: at this time the :has selector is not considered fast, which means that it may not be available for use in stylesheets.
Where else is a CSS selector useful? In particular, where else is the most interesting part of CSS Selectors 4 going to be useful? Don't tell me Javascript code, because I can already do this stuff in Javascript code, and more, without having to worry about browser support for a new CSS standard.
I'm the author of the post linked here, but not the author of the spec. My goal was to introduce the new features -- obviously there was a bit of a "deep end" problem talking about :has and I need to do a bit more work on that part of the post.
Obviously I can't read the minds of the spec writers, but I imagine they don't know what the performance implications of :has() is right now and they don't want to commit to something that kills browser performance once it's out there in the wild.
So maybe wait until there's an implementation before deciding whether it's a good thing to have in the spec?
(I don't necessarily mean "a vendor-specific implementation in a released browser" - but someone should be coding prototypes of this stuff. Adobe did it for some of their new additions - clearly marked as experimental in special builds of Chromium)
The general attitude is that things get in the spec once there is rough consensus they should be implemented, but can be dropped if they turn out to be unworkable with implementation experience.
Given how close CSS selector semantics are to things like XPath I wonder if they'll eventually converge to being equivalent.
I think that :has syntax is pretty horrific... the '!' syntax was much simpler to read, but I see the reasoning behind making it function-like as the subject of the selector then remains looking like it did before.
It's not a selector, it's a property. It exists, but support is not good. It's been behind a flag in Chrome for over well two years. http://caniuse.com/#search=sticky
You can use nth-child/nth-last-child for much more than table even/odd styling. It can be used to style children based on the number of siblings they have, build grids out of list items, or style grid interval tick marks on a timeline off the top of my head.
It's just a nice thing most browsers do. It's a part of those browsers, not the web. Most browsers have tabs these days, but tabs aren't part of the web either.
Last I heard, if there are two different implementations of a feature, the W3C considers it to be a de facto standard.
Nor are there any useful distinctions between "browsers" and "the web".
What I suggest is that CSS 4 have the necessary functionality to specify styling of tooltips. It's not that bizarre of an idea. You could set the font, for instance, or colors, or borders. Likely once it becomes a psuedo-element, you could do even fancier things with it.
:has sounds like it can lead to a maintenance mess and makes styles being tied to specific mark-up. I can imagine how easy it will be to accidentally add stuff that some broad rule will assimilate, or remove styling because you add an innocent element to the block. It locks down stuff the same way too much nesting does.
And what does this mean?
Where else is a CSS selector useful? In particular, where else is the most interesting part of CSS Selectors 4 going to be useful? Don't tell me Javascript code, because I can already do this stuff in Javascript code, and more, without having to worry about browser support for a new CSS standard.