Skip to content

A complete AI agency at your fingertips - From frontend wizards to Reddit community ninjas, from whimsy injectors to reality checkers. Each agent is a specialized expert with personality, processes, and proven deliverables.

Shell

Strip event handlers on the snapshot root as well as descendants

Rudy Celekli79bbaede7d64
diff --git a/engineering/engineering-pdf-engine-architect.md b/engineering/engineering-pdf-engine-architect.md
index 27b78997..8737e44e 100644
--- a/engineering/engineering-pdf-engine-architect.md
+++ b/engineering/engineering-pdf-engine-architect.md
@@ -160,7 +160,8 @@ export class DOMSnapshotSerializer {
const dangerousTags = clone.querySelectorAll('script, iframe, object, embed, applet');
dangerousTags.forEach((el) => el.remove());
- const allElements = clone.querySelectorAll('*');
+ // querySelectorAll('*') excludes the root itself.
+ const allElements = [clone, ...Array.from(clone.querySelectorAll('*'))];
allElements.forEach((el) => {
Array.from(el.attributes).forEach((attr) => {
if (attr.name.toLowerCase().startsWith('on')) {