diff --git a/lib/core/utils/dq-element.js b/lib/core/utils/dq-element.js index 3cf790fe..47bcc64e 100644 --- a/lib/core/utils/dq-element.js +++ b/lib/core/utils/dq-element.js @@ -26,7 +26,11 @@ function getSource(element) { if (!source && typeof window.XMLSerializer === 'function') { source = new window.XMLSerializer().serializeToString(element); } - return truncate(source || ''); + let htmlString = truncate(source || ''); + // Remove unwanted attributes + const regex = /\s*data-percy-[^=]+="[^"]*"/g; + htmlString = htmlString.replace(regex, ''); + return htmlString; } /**