Skip to content

Commit

Permalink
fix(general): Fix descendant cache typo
Browse files Browse the repository at this point in the history
  • Loading branch information
fb55 committed Oct 2, 2020
1 parent b8ae895 commit 0c0a8ff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/general.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export function compileGeneralSelector<Node, ElementNode extends Node>(
let current: ElementNode | null = elem;

while ((current = adapter.getParent(current))) {
if (!isFalseCache.has(elem)) {
if (!isFalseCache.has(current)) {
if (next(current)) return true;
isFalseCache.add(current);
}
Expand Down
9 changes: 9 additions & 0 deletions test/sizzle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1727,4 +1727,13 @@ describe("Sizzle", () => {
document.getElementById("foo")
);
});

it("more specific selector should find less elements", () => {
// Same selector, but with an attribute filter added
expect(
CSSselect.selectAll("#qunit-fixture div div", document).length
).toBeGreaterThanOrEqual(
CSSselect.selectAll("#qunit-fixture div div[id]", document).length
);
});
});

0 comments on commit 0c0a8ff

Please sign in to comment.