Style shadowRoot

Allow stylus to target elements in shadow-root

目前为 2023-02-10 提交的版本。查看 最新版本

作者
Achernar
评分
0 0 0
版本
0.1
创建于
2023-02-10
更新于
2023-02-10
大小
4.4 KB
许可证
暂无
适用于

This userscript allows Stylus'users to style shadow-DOM elements that are by definition out of reach of global stylesheets.

Any style rule whose selectors includes :host or :host-context will be injected into the shadow-root node.

By default the userscript is not executed on any website. You'll have to edit the style settings (eg. in tampermonkey) open the userstyle, go to the style's "settings" tab and add the mask (don't forget the *) of the website(s) you want to run it on.

To test:

  • add https://web.archive.org/web/* to "user matches"
  • go to https://web.archive.org/web/2/ appended with the full url of a webpage.
  • open stylus. Edit a new stylesheet, matching https://web.archive.org/web/* and define this style: :host * { outline: 1px solid red !important; }