Skip to content

Commit

Permalink
Merge pull request #1029 from vivliostyle/fix/issue1028
Browse files Browse the repository at this point in the history
fix: Error with undefined CSS variables in calc expression in shorthand property
  • Loading branch information
MurakamiShinyu authored Oct 21, 2022
2 parents c0b5fca + db948cb commit 2d0dd9d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/core/src/vivliostyle/css-cascade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4400,11 +4400,15 @@ export class CalcFilterVisitor extends Css.FilterVisitor {
return value;
}
const exprText = value.toString().replace(/^calc\b/, "-epubx-expr");
if (/\d(%|em|ex|cap|ch|ic|lh|p?v[whbi]|p?vmin|p?vmax)\W/i.test(exprText)) {
if (
/\d(%|em|ex|cap|ch|ic|lh|p?v[whbi]|p?vmin|p?vmax)\W|\Wvar\(\s*--/i.test(
exprText,
)
) {
return value;
}
const exprVal = CssParser.parseValue(
null,
this.context.rootScope,
new CssTokenizer.Tokenizer(exprText, null),
"",
);
Expand Down

1 comment on commit 2d0dd9d

@vercel
Copy link

@vercel vercel bot commented on 2d0dd9d Oct 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

vivliostyle – ./

vivliostyle-git-master-vivliostyle.vercel.app
vivliostyle.vercel.app
vivliostyle-vivliostyle.vercel.app

Please sign in to comment.