Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#692@patch: Fixed CSSContainerRule, CSSMediaRule conditionText typo #692

Merged
merged 1 commit into from Jan 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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;
}
}