hopefully fix css hang

This commit is contained in:
CoolElectronics 2024-04-09 22:28:49 -04:00
parent 90d7cf7f85
commit bd347052e9
No known key found for this signature in database
GPG key ID: F63593D168636C50
2 changed files with 3 additions and 3 deletions

View file

@ -24,7 +24,8 @@ export function css(strings, ...values) {
let newstr = '' let newstr = ''
let selfstr = '' let selfstr = ''
while (!styleElement.sheet.cssRules.length) { while (!styleElement.sheet.cssRules.length) {
let [first, ...rest] = str.split('\n') let [first, ...rest] = str.split('\n');
if (!first) break;
selfstr += first + '\n' selfstr += first + '\n'
str = rest.join('\n') str = rest.join('\n')
styleElement.textContent = str styleElement.textContent = str
@ -36,7 +37,6 @@ export function css(strings, ...values) {
} }
styleElement.textContent = `.${uid} {${selfstr}}` + '\n' + newstr styleElement.textContent = `.${uid} {${selfstr}}` + '\n' + newstr
console.log(styleElement.textContent)
cssmap[str] = uid cssmap[str] = uid
return uid return uid

View file

@ -18,6 +18,6 @@
"noUncheckedIndexedAccess": true "noUncheckedIndexedAccess": true
}, },
"include": ["./examples/*.ts", "./examples/*.tsx", "./DreamlandJS.d.ts"], "include": ["./examples/*.ts", "./examples/*.tsx", "./dreamland.d.ts"],
"exclude": ["node_modules/**/*"] "exclude": ["node_modules/**/*"]
} }