Remove text opacity CSS variables from ::marker (#8622)
* Refactor * Allow parallel variant fns to mutate the container * Remove text color variable from marker pseudo class wip * Update changelog
This commit is contained in:
parent
22eaad17c3
commit
15dc5a3da9
7 changed files with 115 additions and 32 deletions
24
src/util/removeAlphaVariables.js
Normal file
24
src/util/removeAlphaVariables.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
/**
|
||||
* This function removes any uses of CSS variables used as an alpha channel
|
||||
*
|
||||
* This is required for selectors like `:visited` which do not allow
|
||||
* changes in opacity or external control using CSS variables.
|
||||
*
|
||||
* @param {import('postcss').Container} container
|
||||
* @param {string[]} toRemove
|
||||
*/
|
||||
export function removeAlphaVariables(container, toRemove) {
|
||||
container.walkDecls((decl) => {
|
||||
if (toRemove.includes(decl.prop)) {
|
||||
decl.remove()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
for (let varName of toRemove) {
|
||||
if (decl.value.includes(`/ var(${varName})`)) {
|
||||
decl.value = decl.value.replace(`/ var(${varName})`, '')
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue