workaround for FireFox theme-controller CSS selector bug

fix: #2503
fix: #2525
This commit is contained in:
Pouya Saadeghi 2023-11-15 02:57:55 +03:30
parent e00b3d9814
commit a6e16324e7
3 changed files with 8 additions and 23 deletions

View File

@ -3,7 +3,7 @@ const responsiveRegex = require("../lib/responsiveRegex")
const utilityClasses = require("../lib/utility-classes")
module.exports = {
content: [{ raw: "" }],
content: [{ raw: '<input class="theme-controller" checked/>', extension: "html" }],
safelist: responsiveRegex,
theme: {
colors: require("../theming"),

View File

@ -1,5 +1,5 @@
module.exports = {
content: [{ raw: "" }],
content: [{ raw: '<input class="theme-controller" checked/>', extension: "html" }],
experimental: {
optimizeUniversalDefaults: true,
},

View File

@ -202,34 +202,19 @@ module.exports = {
}
}
// theme 0 with name
themesToInject["[data-theme=" + themeOrder[0] + "]"] = includedThemesObj[themeOrder[0]]
themesToInject[
"[data-theme=" +
themeOrder[0] +
"], " +
themeRoot +
":has(input.theme-controller[value=" +
themeOrder[0] +
"]:checked)"
themeRoot + ":has(input.theme-controller[value=" + themeOrder[0] + "]:checked)"
] = includedThemesObj[themeOrder[0]]
// theme 1 with name
themesToInject["[data-theme=" + themeOrder[1] + "]"] = includedThemesObj[themeOrder[1]]
themesToInject[
"[data-theme=" +
themeOrder[1] +
"], " +
themeRoot +
":has(input.theme-controller[value=" +
themeOrder[1] +
"]:checked)"
themeRoot + ":has(input.theme-controller[value=" + themeOrder[1] + "]:checked)"
] = includedThemesObj[themeOrder[1]]
} else {
themesToInject["[data-theme=" + themeName + "]"] = includedThemesObj[themeName]
themesToInject[
"[data-theme=" +
themeName +
"], " +
themeRoot +
":has(input.theme-controller[value=" +
themeName +
"]:checked)"
themeRoot + ":has(input.theme-controller[value=" + themeName + "]:checked)"
] = includedThemesObj[themeName]
}
})