stylus icon indicating copy to clipboard operation
stylus copied to clipboard

Per-style CSS origin option

Open silverwind opened this issue 8 years ago • 4 comments

Lifting this out of https://github.com/openstyles/stylus/issues/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.

silverwind avatar Jan 05 '18 14:01 silverwind

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.

tophf avatar Jan 05 '18 15:01 tophf

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.

silverwind avatar Jan 05 '18 15:01 silverwind

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.

ExE-Boss avatar Oct 27 '19 10:10 ExE-Boss

This is covered by #827.

tophf avatar Oct 09 '20 16:10 tophf