From 13fbd822c910df58b9f8aebd64da44f21a4f8b65 Mon Sep 17 00:00:00 2001 From: Utkarsh Chaudhary Date: Tue, 3 Feb 2026 10:38:40 +0530 Subject: [PATCH] Removing percy attribute before truncate (#188) --- lib/core/utils/dq-element.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/core/utils/dq-element.js b/lib/core/utils/dq-element.js index 373675e3..74b5965d 100644 --- a/lib/core/utils/dq-element.js +++ b/lib/core/utils/dq-element.js @@ -174,10 +174,10 @@ function getSource(element) { if (!source && typeof window.XMLSerializer === 'function') { source = new window.XMLSerializer().serializeToString(element); } - let htmlString = truncate(source || ''); // Remove unwanted attributes - const regex = /\s*data-percy-[^=]+="[^"]*"/g; - htmlString = htmlString.replace(regex, ''); + const regex = /\s*data-percy-[^=]+="[^"]*"/g; // Remove unwanted attributes + source = (source || '').replace(regex, ''); + const htmlString = truncate(source); return htmlString; }