Skip to content
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

[css-cascade-4] An "all-namespaces" user agent stylesheet #8573

Open
jakearchibald opened this issue Mar 13, 2023 · 7 comments
Open

[css-cascade-4] An "all-namespaces" user agent stylesheet #8573

jakearchibald opened this issue Mar 13, 2023 · 7 comments
Labels
css-cascade-4 Current Work

Comments

@jakearchibald
Copy link
Contributor

jakearchibald commented Mar 13, 2023

Right now we have:

But some styles should span all three, for example view transition pseudo-element styles, but perhaps also things like ::selection.

It feels like we need a central "all-namespaces user agent stylesheet". Other specs could define a set of styles, and the central "all-namespaces user agent stylesheet" spec would include them (this would also define the ordering of styles from different specs).

@gsnedders gsnedders added the css-cascade-4 Current Work label Mar 13, 2023
@gsnedders
Copy link
Member

I'm gonna label this with Cascade on the basis the underlying problem here is that it defines that:

Conforming user agents must apply a default style sheet (or behave as if they did).

Except as demonstrated by the links above, specs don't actually define a default style sheet, they define many default style sheets and it's undefined what the "Order of Appearance" of the various stylesheets is. It's also unclear if it's intended that each specification needs to consider the specificity of every other selector defined in every other specification to avoid unintended results.

@jakearchibald jakearchibald changed the title An "all-namespaces" user agent stylesheet [css-cascade-4] An "all-namespaces" user agent stylesheet Mar 13, 2023
@gsnedders
Copy link
Member

For the record, other UA stylesheets defined include:

@gsnedders
Copy link
Member

And to be clear: as long as we don't care about specifying position in the cascade, there's no reason why each spec can't define its own stylesheet (e.g., CSS View Transitions defining its own styles that cover all namespaces).

@jakearchibald
Copy link
Contributor Author

When can we be sure we don't need to care about position? I suppose with view transitions, since it only deals in view transition pseudos/properties, position doesn't matter. Unless… some other CSS spec in future creates a UA sheet that also deals in view transition pseudos/properties.

@fantasai
Copy link
Collaborator

fantasai commented May 31, 2023

I'm not sure there's actually an issue here? The stylesheets you linked contain namespaced rules: if you apply them to every single document loaded by the UA, you'll get the expected behavior. As for how the UA splits up the stylesheets into individual files internally: that's an implementation detail that we don't need to care about. If they want to put them all into a single file, using individually namespaced selectors instead of file-level default @namespace... that should be fine.

To the extent that CSS spec themselves define UA rules that apply to all namespaces (e.g. for View Transitions), they simply need to use selectors that are not namespaced.

If there are order dependencies among the rules, we do need to be careful to spec those explicitly. But I don't think we have any such cases atm?

It might be nice to have an index of all of the UA rules, but other than that, I don't think there's anything to do here. @jakearchibald am I missing something?

@annevk
Copy link
Member

annevk commented Jun 1, 2023

I think what @jakearchibald was looking for is having a small set of centrally maintained normative user agent style sheets. We have that for HTML, SVG, and MathML, but there's no such style sheet for *|*.

The user agent style sheets @gsnedders pointed out seem somewhat confusing to me. Some seem to monkey patch SVG, others are informative, but don't mention the normative style sheet (though some do). Just referencing the normative material would go a long way I think.

@svgeesus
Copy link
Contributor

svgeesus commented Jun 5, 2023

Also

(as did CSS Color 3 and CSS Color 4).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css-cascade-4 Current Work
Projects
None yet
Development

No branches or pull requests

5 participants