Skip to content

Commit ea2e9dc

Browse files
committed
Apply user styles regardless they have less specificity #3153
1 parent 3ec2c63 commit ea2e9dc

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

webextensions/sidebar/sidebar.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,19 @@ async function applyOwnTheme(style) {
379379
}
380380

381381
function applyUserStyleRules() {
382-
mUserStyleRules.textContent = loadUserStyleRules();
382+
mUserStyleRules.textContent = `
383+
/* Simple selectors in user styles may have specificity lower than the one of
384+
built-in CSS declarations of TST itself.
385+
CSS media query (@media) should not affect to specificity of selectors in
386+
itself, but actually declarations with lower specificity are applied if they
387+
are wrapped with any media query - just for now (Firefox 102).
388+
So TST wraps all user styles inside a needless media query for convenience.
389+
This workaround should allow people to write more simpler user styles.
390+
See also: https://github.com/piroor/treestyletab/issues/3153#issuecomment-1184619369 */
391+
@media all {
392+
${loadUserStyleRules()}
393+
}
394+
`;
383395
}
384396

385397
async function applyBrowserTheme(theme) {

0 commit comments

Comments
 (0)