Skip to content

Commit 13fbd82

Browse files
authored
Removing percy attribute before truncate (#188)
1 parent 09298a2 commit 13fbd82

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/core/utils/dq-element.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,10 @@ function getSource(element) {
174174
if (!source && typeof window.XMLSerializer === 'function') {
175175
source = new window.XMLSerializer().serializeToString(element);
176176
}
177-
let htmlString = truncate(source || '');
178177
// Remove unwanted attributes
179-
const regex = /\s*data-percy-[^=]+="[^"]*"/g;
180-
htmlString = htmlString.replace(regex, '');
178+
const regex = /\s*data-percy-[^=]+="[^"]*"/g; // Remove unwanted attributes
179+
source = (source || '').replace(regex, '');
180+
const htmlString = truncate(source);
181181
return htmlString;
182182
}
183183

0 commit comments

Comments
 (0)