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

Per-style CSS origin option #325

Open
silverwind opened this issue Jan 5, 2018 · 4 comments
Open

Per-style CSS origin option #325

silverwind opened this issue Jan 5, 2018 · 4 comments

Comments

@silverwind
Copy link
Contributor

silverwind commented Jan 5, 2018

Lifting this out of #248 which is also a dependency for this issue.

tabs.insertCSS features a cssOrigin option with values 'author' (default) and 'user'. I think it makes sense to expose this option to style authors via a new usercss option as well as adding a select box in the style options to change the CSS origin.

The option is implemented in Firefox since version 53 and will likely be in Chromium 66 pending review.

@tophf
Copy link
Member

tophf commented Jan 5, 2018

Let's see how the implementation will actually fare. I'm quite sure it'll have its own issues. Maybe it'll be even inferior to the one we currently use in some aspects due to the inherent limitations of WebExtensions API. Also, what makes sense to a style author doesn't necessarily make sense to a user. We could add dozens of arcane options that will be used by 1 user out of 10k once a year. Maybe a better solution would be to have only a global option. Or maybe we could use a comment like the infamous AGENT_SHEET. Or maybe we should expose this option only for usercss styles and add a meta key like @css-origin.

@silverwind
Copy link
Contributor Author

silverwind commented Jan 5, 2018

In my opinion user styles should always outweight page styles, but the CSS cascade spec is broken in this regard. It currently goes

  • user normal -> author normal -> author !important -> user !imporant

We wouldn't even have this issue in first place if it were the more sane

  • author normal -> user normal -> author !important -> user !imporant

With such a cascade, you could insert all styles as user. But I guess this can't possibly be changed by browser vendors.

@ExE-Boss
Copy link

In my opinion user styles should always outweight page styles, but the CSS cascade spec is broken in this regard. It currently goes

* `user normal` -> `author normal` -> `author !important` -> `user !imporant`

We wouldn't even have this issue in first place if it were the more sane

* `author normal` -> `user normal` -> `author !important` -> `user !imporant`

With such a cascade, you could insert all styles as user. But I guess this can't possibly be changed by browser vendors.

The thing is, you should use user !important for that, whereas user normal is for overriding the browser’s default styles.

@tophf
Copy link
Member

tophf commented Oct 9, 2020

This is covered by #827.

@tophf tophf closed this as completed Oct 9, 2020
@eight04 eight04 reopened this Dec 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants