Skip to content

Commit

Permalink
remove unwanted attributes from html string (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhi3685 authored Dec 23, 2024
1 parent 80b022c commit 1be13b9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/core/utils/dq-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit 1be13b9

Please sign in to comment.