From 9eb405c9efd75637a1c02d8acf9be9d2126ca0a8 Mon Sep 17 00:00:00 2001 From: rishigupta1599 Date: Wed, 22 Jul 2026 23:34:45 +0530 Subject: [PATCH] fix(dom): reduce transient allocation during serialize (PER-10135) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Percy snapshot serialization of heavy SPAs allocates large transient strings on the hot tail of every capture. On a customer app already near the renderer memory ceiling, that churn adds GC pressure that can contribute to intermittent renderer OOM / browser disconnects. Two safe, output-preserving reductions: - serialize-dom.js: fold the two marker-rewrite `.replace()` passes (custom-element proxies + serialized attributes) into a single regex pass, halving the large-string allocation churn. Output verified byte-identical. - clone-dom.js: in getOuterHTML, when there are no shadow roots to embed as declarative