File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ ' @clack/ui ' : minor
3+ ---
4+
5+ Add [ Document.querySelectorAll()] ( https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll ) using the existing CSS selector engine. Queries return a snapshot array of matching elements in document order.
Original file line number Diff line number Diff line change 11/* oxlint-disable bombshell-dev/no-generic-error -- Web IDL requires TypeError for missing arguments. */
22
3- import { getElementById , querySelector } from './css-select.ts' ;
3+ import { getElementById , querySelector , querySelectorAll } from './css-select.ts' ;
44import { asciiUppercase , asciiLowercase } from './ascii.ts' ;
55import { NamedNodeMap } from './named-node-map.ts' ;
66import {
@@ -335,6 +335,14 @@ export class Document extends Node {
335335 return querySelector ( Array . from ( this . childNodes ) , selector ) ;
336336 }
337337
338+ querySelectorAll ( selector : string ) : Element [ ] {
339+ if ( arguments . length === 0 ) {
340+ throw new TypeError ( 'querySelectorAll requires a selector' ) ;
341+ }
342+ const selectors = `${ selector } ` ;
343+ return querySelectorAll ( Array . from ( this . childNodes ) , selectors ) ;
344+ }
345+
338346 getElementById ( id : string ) : Element | null {
339347 if ( arguments . length === 0 ) {
340348 throw new TypeError ( 'getElementById requires an ID' ) ;
Original file line number Diff line number Diff line change @@ -77,6 +77,15 @@ const config: WPTConfig = {
7777 'html/dom/reflection-misc.html' : [ / ^ h t m l \. i n e r t : / , / ^ h t m l \. t a b I n d e x : / ] ,
7878 'html/dom/reflection-forms.html' : [ / ^ b u t t o n \. t a b I n d e x : / ] ,
7979 'html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-default-value.html' : true ,
80+ 'dom/nodes/NodeList-Iterable.html' : [ / ^ N o d e L i s t / ] ,
81+ 'dom/nodes/ParentNode-querySelector-All-comma-selector.html' : [
82+ 'Basic comma-separated selector' ,
83+ ] ,
84+ 'dom/nodes/ParentNode-querySelector-invalid-comment-like.html' : [
85+ 'querySelectorAll throws SyntaxError for comment-like selector' ,
86+ ] ,
87+ 'dom/nodes/ParentNode-querySelectorAll-case-insensitive-attribute-flag.html' : true ,
88+ 'dom/nodes/ParentNode-querySelectorAll-nested-not-has.html' : true ,
8089 'dom/nodes/Document-createTextNode.html' : true ,
8190 'dom/nodes/Document-createElement.html' : [ / ^ c r e a t e E l e m e n t \( .* \) i n H T M L d o c u m e n t $ / ] ,
8291 'dom/nodes/Document-createElementNS.html' : [
You can’t perform that action at this time.
0 commit comments