-
Notifications
You must be signed in to change notification settings - Fork 756
Closed
Labels
Description
This is derived from both #3547 and (in particular) #6606, but I've opened a new issue as it's a more specific proposal.
Suggestion is: add a :stylesheet pseudo-class selector which functions like :scope but matches the element that declared the rule - ie the <style> or <link>element that created the stylesheet. For programatically created stylesheets, it would match nothing.
- I suspect this would be very easy to implement as the rule should already have a reference to the stylesheet that declared it.
- it would mean the functionality of the old
<style scoped>syntax could be reproduced. This has been pretty heavily discussed in 3547, it was clearly popular, and while@scopeis good it doesn't(*) provide a direct replacement for that functionality.:stylesheetwould do that:
<style>
@scope (* > :stylesheet) {
...
}
</style>(* you could give the <style> an id and reference that from the @scope rule, so it's technically possible; just not very flexible)