Fix style setting in Chrome.
This commit is contained in:
parent
4314b48924
commit
e81b3ea245
1 changed files with 2 additions and 0 deletions
|
@ -22,6 +22,7 @@ const setStyle = (href) => {
|
||||||
|
|
||||||
const setDynamic = () => {
|
const setDynamic = () => {
|
||||||
const baseEl = document.createElement('div')
|
const baseEl = document.createElement('div')
|
||||||
|
body.appendChild(baseEl)
|
||||||
baseEl.setAttribute('class', 'base05')
|
baseEl.setAttribute('class', 'base05')
|
||||||
const base05Color = window.getComputedStyle(baseEl).getPropertyValue('color')
|
const base05Color = window.getComputedStyle(baseEl).getPropertyValue('color')
|
||||||
baseEl.setAttribute('class', 'base08')
|
baseEl.setAttribute('class', 'base08')
|
||||||
|
@ -29,6 +30,7 @@ const setStyle = (href) => {
|
||||||
const styleEl = document.createElement('style')
|
const styleEl = document.createElement('style')
|
||||||
head.appendChild(styleEl)
|
head.appendChild(styleEl)
|
||||||
const styleSheet = styleEl.sheet
|
const styleSheet = styleEl.sheet
|
||||||
|
body.removeChild(baseEl)
|
||||||
|
|
||||||
styleSheet.insertRule(`a { color: ${base08Color}`, 'index-max')
|
styleSheet.insertRule(`a { color: ${base08Color}`, 'index-max')
|
||||||
styleSheet.insertRule(`body { color: ${base05Color}`, 'index-max')
|
styleSheet.insertRule(`body { color: ${base05Color}`, 'index-max')
|
||||||
|
|
Loading…
Reference in a new issue