mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-22 04:34:44 +00:00
Merge pull request #1749 from lightpanda-io/empty_is_and_where_pseudoselector
Empty :is() and :where() pseudoselectors are valid (and return nothing)
This commit is contained in:
@@ -81,6 +81,17 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<script id="is_empty">
|
||||
{
|
||||
// Empty :is() and :where() are valid per spec and match nothing
|
||||
const isEmptyResult = document.querySelectorAll(':is()');
|
||||
testing.expectEqual(0, isEmptyResult.length);
|
||||
|
||||
const whereEmptyResult = document.querySelectorAll(':where()');
|
||||
testing.expectEqual(0, whereEmptyResult.length);
|
||||
}
|
||||
</script>
|
||||
|
||||
<div id=escaped class=":popover-open"></div>
|
||||
<script id="escaped">
|
||||
{
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
// Empty functional pseudo-classes should error
|
||||
testing.expectError("Error: InvalidPseudoClass", () => container.querySelector(':has()'));
|
||||
testing.expectError("Error: InvalidPseudoClass", () => container.querySelector(':not()'));
|
||||
testing.expectError("Error: InvalidPseudoClass", () => container.querySelector(':is()'));
|
||||
testing.expectError("Error: InvalidPseudoClass", () => container.querySelector(':where()'));
|
||||
testing.expectError("Error: InvalidPseudoClass", () => container.querySelector(':lang()'));
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -487,7 +487,7 @@ fn pseudoClass(self: *Parser, arena: Allocator, page: *Page) !Selector.PseudoCla
|
||||
if (self.peek() != ')') return error.InvalidPseudoClass;
|
||||
self.input = self.input[1..];
|
||||
|
||||
if (selectors.items.len == 0) return error.InvalidPseudoClass;
|
||||
// Empty :is() is valid per spec - matches nothing
|
||||
return .{ .is = selectors.items };
|
||||
}
|
||||
|
||||
@@ -514,7 +514,7 @@ fn pseudoClass(self: *Parser, arena: Allocator, page: *Page) !Selector.PseudoCla
|
||||
if (self.peek() != ')') return error.InvalidPseudoClass;
|
||||
self.input = self.input[1..];
|
||||
|
||||
if (selectors.items.len == 0) return error.InvalidPseudoClass;
|
||||
// Empty :where() is valid per spec - matches nothing
|
||||
return .{ .where = selectors.items };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user