Re: [csswg-drafts] [selectors-4] Allow * before a type selector (#8253)

> We want to minimize syntactic differences between rules that are valid in nested context and those that are valid in other contexts (such as top-level or inside @scope), so that they can be copy-pasted between contexts.

In the real-world, this only helps when copying from a context where the leading `*` is necessary to one where it isn't.

I suspect (at least at first), the bulk of copy/paste is going to be from a top-level context to a nested rule, and that's going to require fixups after the paste (or at least a manual check to see if fixups are necessary).

Allowing style rules with a prefixed `@` at the top-level would be a trivial and safe change and would allow copy/paste from nested blocks to top-level without midification.

> A lot (probably most) of selectors in real-world websites don't start with a tag name, they start with a class, pseudo-class, or ID selector and therefore don't need a prefix.

Right, but not all. If you can't accept all rules without fixup, then I assert making copy/paste easier in _some_ cases is actually worse. People are going to be more prone to copy a large block of rule and miss the few cases where a fixup is required and are going to have broken rules. If there's a simple and consistent change that has to be made to all rules when pasting into a nested context, then the change can be easily made by tooling.

-- 
GitHub Notification of comment by plinss
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8253#issuecomment-1364349912 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 23 December 2022 21:39:05 UTC