[chore]: rm inlined JS from snapshot.ts
#1427
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
why
a11y/snapshot.tshas large inline stringified scripts for scroll offsets, active-element lookup, and XPath building. stringified JS is not good practice as it is difficult to debug and is ignored by lintingsnapshot.tswhich already exists insidelocatorScriptsdirwhat changed
lib/v3/dom/a11yScriptsplus a newgenA11yScripts.tsgenerator so those helpers are bundled once, exported as strings and injected as neededbuildA11yInvocation&buildLocatorInvocationhelpers that wrap the JS expressions with a guard that checks if the script already existsa11y/snapshot.tsto consume the generated helpers for scroll offsets, deep-active resolution, and XPath serialization, and to call locator scripts for CSS/XPath queries instead of embedding custom JS strings.test plan
Summary by cubic
Replaced inline stringified JS in a11y/snapshot.ts with a generated a11y script bundle and small invocation helpers for cleaner, lintable code. Also routed CSS/XPath queries through existing locator scripts to remove duplicated logic.
Written for commit a799be8. Summary will update automatically on new commits.