Skip to content

Commit

Permalink
Resolve null sheet in convertInlineCss (#2784)
Browse files Browse the repository at this point in the history
* init

* update
  • Loading branch information
BryanValverdeU authored Sep 4, 2024
1 parent ab11e03 commit 92de0a6
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,18 @@ export function retrieveCssRules(doc: Document): CssRule[] {
const result: CssRule[] = [];

styles.forEach(styleNode => {
const sheet = styleNode.sheet as CSSStyleSheet;
const sheet = styleNode.sheet;

for (let ruleIndex = 0; ruleIndex < sheet.cssRules.length; ruleIndex++) {
const rule = sheet.cssRules[ruleIndex] as CSSStyleRule;
if (sheet) {
for (let ruleIndex = 0; ruleIndex < sheet.cssRules.length; ruleIndex++) {
const rule = sheet.cssRules[ruleIndex] as CSSStyleRule;

if (rule.type == CSSRule.STYLE_RULE && rule.selectorText) {
result.push({
selectors: splitSelectors(rule.selectorText),
text: rule.style.cssText,
});
if (rule.type == CSSRule.STYLE_RULE && rule.selectorText) {
result.push({
selectors: splitSelectors(rule.selectorText),
text: rule.style.cssText,
});
}
}
}

Expand Down

0 comments on commit 92de0a6

Please sign in to comment.