You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8808e39
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/api.md
+31-31Lines changed: 31 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,49 +23,49 @@ Select descendants, test a match, or find the nearest matching ancestor.
23
23
24
24
| Method | Result |
25
25
| --- | --- |
26
-
|[`closest(selectors, element, callback)`](../src/nwsapi.mts#L5732)| Returns the nearest match, starting with the element, or `null`. |
27
-
|[`first(selectors, context, callback)`](../src/nwsapi.mts#L5728)| Returns the first matching descendant, or `null`. |
28
-
|[`match(selectors, element, callback)`](../src/nwsapi.mts#L5729)| Returns whether the element matches. |
29
-
|[`select(selectors, context, callback)`](../src/nwsapi.mts#L5730)| Returns matching descendants. Results are arrays by default. `NODE_LIST` can enable static NodeList results. |
26
+
|[`closest(selectors, element, callback)`](../src/nwsapi.mts#L5739)| Returns the nearest match, starting with the element, or `null`. |
27
+
|[`first(selectors, context, callback)`](../src/nwsapi.mts#L5735)| Returns the first matching descendant, or `null`. |
28
+
|[`match(selectors, element, callback)`](../src/nwsapi.mts#L5736)| Returns whether the element matches. |
29
+
|[`select(selectors, context, callback)`](../src/nwsapi.mts#L5737)| Returns matching descendants. Results are arrays by default. `NODE_LIST` can enable static NodeList results. |
30
30
31
31
### Look up elements
32
32
33
33
Find elements directly by class, ID, or tag name.
34
34
35
35
| Method | Result |
36
36
| --- | --- |
37
-
|[`byClass(cls, context)`](../src/nwsapi.mts#L5726)| Returns elements with the class name. |
38
-
|[`byId(id, context)`](../src/nwsapi.mts#L5724)| Returns elements with the ID. Duplicate IDs are allowed by default. |
39
-
|[`byTag(tag, context)`](../src/nwsapi.mts#L5725)| Returns elements with the tag name. Use `*` for all elements. |
37
+
|[`byClass(cls, context)`](../src/nwsapi.mts#L5733)| Returns elements with the class name. |
38
+
|[`byId(id, context)`](../src/nwsapi.mts#L5731)| Returns elements with the ID. Duplicate IDs are allowed by default. |
39
+
|[`byTag(tag, context)`](../src/nwsapi.mts#L5732)| Returns elements with the tag name. Use `*` for all elements. |
40
40
41
41
### Configure the engine
42
42
43
43
Change engine options and error handling.
44
44
45
45
| Method | Result |
46
46
| --- | --- |
47
-
|[`configure(option, clear)`](../src/nwsapi.mts#L5735)| Reads or changes options. Pass `true` as the second argument to clear compiled selectors. |
48
-
|[`emit(message, proto)`](../src/nwsapi.mts#L5737)| Reports an error using the configured error policy. |
47
+
|[`configure(option, clear)`](../src/nwsapi.mts#L5742)| Reads or changes options. Pass `true` as the second argument to clear compiled selectors. |
48
+
|[`emit(message, proto)`](../src/nwsapi.mts#L5744)| Reports an error using the configured error policy. |
49
49
50
50
### Compile and extend selectors
51
51
52
52
Advanced APIs for compiled resolvers and trusted selector extensions.
53
53
54
54
| Method | Result |
55
55
| --- | --- |
56
-
|[`compile(selector, mode, callback, relative)`](../src/nwsapi.mts#L5734)| Compiles a selector into a resolver function. This is an advanced API. |
57
-
|[`registerCombinator(combinator, resolver)`](../src/nwsapi.mts#L5750)| Adds a relationship between elements using trusted resolver code. |
58
-
|[`registerOperator(operator, resolver)`](../src/nwsapi.mts#L5778)| Adds an attribute operator using a resolver with `p1`, `p2`, and `p3` fields. |
59
-
|[`registerSelector(name, rexp, func)`](../src/nwsapi.mts#L5803)| Adds a selector pattern and a compiler callback that returns `source` and `status`. |
56
+
|[`compile(selector, mode, callback, relative)`](../src/nwsapi.mts#L5741)| Compiles a selector into a resolver function. This is an advanced API. |
57
+
|[`registerCombinator(combinator, resolver)`](../src/nwsapi.mts#L5757)| Adds a relationship between elements using trusted resolver code. |
58
+
|[`registerOperator(operator, resolver)`](../src/nwsapi.mts#L5785)| Adds an attribute operator using a resolver with `p1`, `p2`, and `p3` fields. |
59
+
|[`registerSelector(name, rexp, func)`](../src/nwsapi.mts#L5810)| Adds a selector pattern and a compiler callback that returns `source` and `status`. |
60
60
61
61
### Override browser DOM methods
62
62
63
63
Calling `NW.Dom.install()` redirects native `querySelector()`, `querySelectorAll()`, `matches()`, and `closest()` calls to NWSAPI. `uninstall()` restores them. Direct engine calls work without installation.
64
64
65
65
| Method | Result |
66
66
| --- | --- |
67
-
|[`install(all)`](../src/nwsapi.mts#L5743)| Replaces native selector methods; `querySelectorAll()` returns static NodeList-compatible snapshots. The `all` flag enables legacy iframe-load handling. |
68
-
|[`uninstall()`](../src/nwsapi.mts#L5744)| Restores the native methods saved by `install()`. |
67
+
|[`install(all)`](../src/nwsapi.mts#L5750)| Replaces native selector methods; `querySelectorAll()` returns static NodeList-compatible snapshots. The `all` flag enables legacy iframe-load handling. |
68
+
|[`uninstall()`](../src/nwsapi.mts#L5751)| Restores the native methods saved by `install()`. |
69
69
70
70
<details>
71
71
<summary>Configuration</summary>
@@ -100,22 +100,22 @@ These exports support extensions and debugging. Prefer query methods and `config
100
100
101
101
| Member | Purpose |
102
102
| --- | --- |
103
-
|[`CFG`](../src/nwsapi.mts#L5712)| Contains the compiler syntax settings. |
104
-
|[`Config`](../src/nwsapi.mts#L5738)| Contains the active options. Use `configure()` to change them. |
105
-
|[`M_BODY`](../src/nwsapi.mts#L5715)| Contains the matching resolver body template. |
106
-
|[`M_TEST`](../src/nwsapi.mts#L5719)| Contains the matching resolver test template. |
107
-
|[`matchLambdas`](../src/nwsapi.mts#L5704)| Caches compiled matching functions, not DOM results. |
108
-
|[`matchResolvers`](../src/nwsapi.mts#L5707)| Caches matching plans, not DOM results. |
109
-
|[`N_BODY`](../src/nwsapi.mts#L5716)| Exposes the matching resolver body template. |
110
-
|[`N_TEST`](../src/nwsapi.mts#L5720)| Contains the alternate resolver test template. |
Copy file name to clipboardExpand all lines: test/repo/README.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,8 +14,10 @@ under `test/`; the pristine WPT checkout remains under `upstream/wpt/`.
14
14
15
15
`pnpm run test:fuzz` runs Vitiate's coverage-guided selector targets for 15 seconds each.
16
16
Set `FUZZ_TIME_MS` to change the budget. Generated valid selectors are checked against an independent engine before and after DOM mutation; arbitrary bytes exercise parser error handling.
17
+
Agent sessions use minimal harness output and suppress routine progress, using the same Socket Lib-derived `isAgent` helper as unit tests. Interactive runs retain normal progress. Set `FUZZ_VERBOSE=1` for detailed output; failures and saved input paths are always reported.
17
18
`pnpm run test:fuzz:replay` reruns saved seeds, coverage corpus, crashes and timeouts from `.vitiate/`.
18
19
This is a cumulative corpus replay, not a reconstruction of the last run's random execution order.
19
20
CI uploads that directory even when a fuzz target fails. To replay a CI run, extract its artifact into `.vitiate/` in this checkout and run the replay command.
20
21
Keep minimized findings as ordinary regression tests before clearing local corpus files.
21
22
The fuzz lane instruments the built engine, while regular tests remain on the ordinary Vitest configuration.
23
+
The substring-based unsafe-eval detector is disabled because compiled selectors legitimately contain input text inside escaped literals. Parser exceptions, result checks, prototype-pollution detection and the other default detectors remain active.
0 commit comments