Skip to content

Commit

Permalink
fix conditionText typo
Browse files Browse the repository at this point in the history
CSSContainerRule, CSSMediaRule has conditionText prop, not conditionalText
  • Loading branch information
dr2009 committed Jan 19, 2023
1 parent 13b1580 commit b2e8fa8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/happy-dom/src/css/CSSParser.ts
Expand Up @@ -51,10 +51,10 @@ export default class CSSParser {
cssRules.push(newRule);
parentRule = newRule;
} else if (selectorText.startsWith('@container')) {
const conditionalText = selectorText.replace(/@container */, '');
const conditionText = selectorText.replace(/@container */, '');
const newRule = new CSSContainerRule();

(<string>newRule.conditionalText) = conditionalText;
(<string>newRule.conditionText) = conditionText;
newRule.parentStyleSheet = parentStyleSheet;
cssRules.push(newRule);
parentRule = newRule;
Expand Down
Expand Up @@ -298,7 +298,7 @@ export default class CSSStyleDeclarationElementStyle {
}
} else if (
rule.type === CSSRuleTypeEnum.mediaRule &&
defaultView.matchMedia((<CSSMediaRule>rule).conditionalText).matches
defaultView.matchMedia((<CSSMediaRule>rule).conditionText).matches
) {
this.parseCSSRules({
elements: options.elements,
Expand Down
4 changes: 2 additions & 2 deletions packages/happy-dom/src/css/rules/CSSContainerRule.ts
Expand Up @@ -6,7 +6,7 @@ import CSSRule from '../CSSRule';
export default class CSSContainerRule extends CSSRule {
public readonly type = CSSRule.CONTAINER_RULE;
public readonly cssRules: CSSRule[] = [];
public readonly conditionalText = '';
public readonly conditionText = '';

/**
* Returns css text.
Expand All @@ -18,6 +18,6 @@ export default class CSSContainerRule extends CSSRule {
for (const cssRule of this.cssRules) {
cssText += cssRule.cssText;
}
return `@container ${this.conditionalText} { ${cssText} }`;
return `@container ${this.conditionText} { ${cssText} }`;
}
}
4 changes: 2 additions & 2 deletions packages/happy-dom/src/css/rules/CSSMediaRule.ts
Expand Up @@ -19,15 +19,15 @@ export default class CSSMediaRule extends CSSRule {
for (const cssRule of this.cssRules) {
cssText += cssRule.cssText;
}
return `@media ${this.conditionalText} { ${cssText} }`;
return `@media ${this.conditionText} { ${cssText} }`;
}

/**
* Returns conditional text.
*
* @returns Conditional text.
*/
public get conditionalText(): string {
public get conditionText(): string {
return this.media.mediaText;
}
}

0 comments on commit b2e8fa8

Please sign in to comment.