Repository navigation
Commit 8a0e94e
Verify the shadow-DOM fix's two unproven claims: nesting depth, closed roots
The previous commit shipped a recursive deep-query helper and claimed
(in its own doc comments) that it handles arbitrary shadow-nesting
depth and degrades gracefully on a closed shadow root — neither claim
had a test. Both turned out to need real verification, not just
inspection:
- fixtures/nested-shadow-dom-form.html nests a second open shadow root
*inside* the first one's <form>. Investigating why this test should
matter (rather than assuming "recursion is recursion") turned up a
subtlety: the existing single-level fixture never actually exercises
DEEP_QUERY_JS's own shadow-crossing — once TARGET_FORM_JS's separate,
self-contained copy of the walk resolves the form, that form's own
field is a same-tree descendant of it, so a plain non-shadow-aware
querySelectorAll starting from the form would already find it. Only a
second, independently-nested shadow root actually requires
DEEP_QUERY_JS (used by check_validation_errors and friends, called
with the form as root, not document) to cross a boundary itself.
Confirmed by temporarily stripping DEEP_QUERY_JS's shadow-crossing
entirely: the single-level fixture's test still passed exactly as
this reasoning predicted, while the new nested one failed.
- fixtures/closed-shadow-dom-form.html's form lives inside a CLOSED
shadow root — genuinely, permanently invisible from outside, by
design. Confirmed the code degrades to a clean "No <form> element
found" (not a crash) by temporarily removing the `if (node.shadowRoot)`
null-guard in both DEEP_QUERY_JS and TARGET_FORM_JS's own copy of the
walk: this reliably threw a real TypeError ("Cannot read properties
of undefined (reading 'children')") surfaced through chromiumoxide as
an Err, proving the guard is load-bearing, before restoring it.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent fe9e910 commit 8a0e94e
3 files changed
Lines changed: 108 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
562 | 562 | | |
563 | 563 | | |
564 | 564 | | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
0 commit comments