- From: vmpstr via GitHub <sysbot+gh@w3.org>
- Date: Thu, 01 Feb 2024 14:57:47 +0000
- To: public-css-archive@w3.org
vmpstr has just created a new issue for https://github.com/w3c/csswg-drafts: == [css-view-transitions-2] Specificity of view transition pseudos with classes == in #8319 we've added `view-transition-class` that reflects in the view transition pseudo tree, so things like the following become valid selectors: ```css /* 1 */ ::view-transition-group(foo) /* any view transition name with any classes */ /* 2 */ ::view-transition-image-pair(*.bar) /* any view transition name with a "bar" class */ /* 3 */ ::view-transition-old(foo.bar) /* foo view transition name with at least class "bar" */ /* 4 */ ::view-transition-new(foo.bar.baz) /* foo view transition name with at least "bar" and "baz" classes */ ``` The question here is which specificity should these view transition elements have. Some points to consider: * It feels like 1 should have higher specificity than 2 (with any number of classes) * None of these should rise to the level of id-like specificity, since it's still just a pseudo element * More classes feels more specific than fewer classes One off-the-top of the head proposal is something like: `class-like-specificity * (5 * id-is-present + number-of-classes)` meaning that the following holds: * 1 has specificity 5 class-like * 2 has specificity 1 class-like * 3 has specificity 6 class-like * 4 has specificity 7 class-like * `::view-transition-group(*)` remains 0 The worry of course is that 5 classes is as specific as 1 name. We could make the constant higher like 10 or something, but there's also a worry that `::view-transition-group(foo)` would become 10 class-like specificity which is pretty high if we combine this with other class like selectors. For example: ``` ::view-transition-group(foo) ``` would be higher specificity (I think) than ``` .foo.bar::view-transition-group(*) ``` which also seems wrong We can have our own specificity ordering within the argument, but how it maps to outside of the argument is unclear /cc @tabatkins @fantasai for question whether there's prior art here Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9887 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 1 February 2024 14:57:49 UTC