-
Notifications
You must be signed in to change notification settings - Fork 719
[selectors-4] Rescope :has to static CSS rather than .querySelector #3925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The linked document also lists the Honestly, as a web developer, I would prefer something less general that can be safely used in styling (like |
I prefer brevity when it comes to CSS. I would prefer :contains() for the syntax because it makes sense to me to read as "x contains y". But :has works too, especially if it matches how PDF renderers use it and if :contains() could be used to match text within an element. |
@fantasai what would you update? Wouldn't a PDF renderer fit the same profile? |
Please. Don't fix what is not broken yet, and it's unclear if it ever gets broken in the future. Don't make simple things complicated. There is no evidence that the "CSS profiles" concept is anything more than a purely theoretical question. Anywhere in practice, there is just CSS. The impossibility to style elements depending on their content or following siblings is a real problem that web developers have suffered from for years. The slowness of the selector that only perhaps would be implemented in the future is not (although the slowness of its script-based alternatives that web devs currently have to resort to probably is!). Please, help solving the real problem. If Even if |
The CSS Working Group just discussed
The full IRC log of that discussion |
I dunno if any engine implementors are here but is there any reason browsers have at not least implemented the partial version of just This would solve a lot of developer's use cases while still leaving the door open for |
@SelenIT Array.from(document.querySelectorAll('a img', img => {
let el = img;
while (!!(el = el.parentElement)) {
if (el.localName.toLowerCase() == 'a') return el;
}
return null;
}); @Jamesernator See also #3345 |
@ExE-Boss agree, this would be more suitable in most practical cases (though this seems to have a slightly different semantics in the unlikely case of nested |
Remove the notion of Live and Snapshot Profiles and mark `:has()` as "at risk" and "optional", according to the [resolution]()#3925 (comment) to #3925
[selectors-4] Mark :has() as at risk and optional, remove profile (solves #3925)
Why is |
Good point! Since we already have two shipped implementations in two most popular engines, does marking |
And it’s not even difficult to implement. |
I've created #8168 to update the at-risk info in that spec. Sebastian |
"At-risk" is a W3C term of art that has meaning only in terms of the W3C Process; marking a feature as "at-risk" allows us to drop it from the spec after it's reached a "stable" level (like Candidate Rec) without as much rigamarole as adding or changing a feature normally would require. But, yes, the at-risk list in Selectors is out-of-date; thanks for the issue, @SebastianZ |
There are no implementations of :has() in .querySelector and the like. However, we do have implementations of :has() in PDF renderers: https://www.princexml.com/doc-refs/#sel-logical
The spec should be updated to reflect this.
The text was updated successfully, but these errors were encountered: