Skip to content

Commit

Permalink
Merge pull request #1342 from vivliostyle/fix/issue1341
Browse files Browse the repository at this point in the history
fix: TypeError occurs when `:has(+ …)` is used with universal or root selector
  • Loading branch information
MurakamiShinyu committed Jun 3, 2024
2 parents a43c2dc + d124d62 commit 4eae55e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/vivliostyle/css-cascade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1328,10 +1328,10 @@ export class MatchesRelationalAction extends MatchesAction {
override apply(cascadeInstance: CascadeInstance): void {
for (const selectorText of this.selectorTexts) {
let selectorWithScope: string;
let scopingRoot: Element;
let scopingRoot: ParentNode;
if (/^\s*[+~]/.test(selectorText)) {
// :has(+ F) or :has(~ F)
scopingRoot = cascadeInstance.currentElement.parentElement;
scopingRoot = cascadeInstance.currentElement.parentNode;
const index = Array.from(scopingRoot.children).indexOf(
cascadeInstance.currentElement,
);
Expand Down

0 comments on commit 4eae55e

Please sign in to comment.