Re: [csswg-drafts] [css-cascade-6] `@base` statement for relative urls in `@sheet`. (#11680)

One concern with an independant `@base` rule is that it could potentially appear anywhere within the rule, which means resources are unknown until the full `@sheet` rule has - at the very least - been tokenized, but more likely fully parsed. It also raises questions around multiple `@base` rules appearing. Additionally it becomes unclear what should happen with OM interaction, e.g. does `sheet.insertRule('@base url("https://example.com/")')` require resources to be re-fetched?

One _potential_ way around these issues is to adjust the syntax to become something like:

```css
@sheet foo base("https://example.com") {
 ...
}
```

Having the function within `@sheet`s prelude means we can:

- Limit the grammar of the prelude so it only occurs once.
- Enforce the base to be resolved as early in the sheets declaration as possible, not locking us out of speculative preperation of subresources.
- Restrict modifications in the CSSOM; the base can be readonly meaning the only way to change it would be to delete the rule or re-serialize it into a new sheet.

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


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

Received on Sunday, 9 February 2025 11:32:57 UTC