Skip to content

Commit

Permalink
core: prevent attribute truncation side-effects
Browse files Browse the repository at this point in the history
  • Loading branch information
csabapalfi committed Oct 1, 2020
1 parent ae69bd6 commit 580f15f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lighthouse-core/lib/page-functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ function getOuterHTMLSnippet(element, ignoreAttrs = [], snippetCharacterLimit =
}

const clone = element.cloneNode();
// prevent any potential side-effects by appending to a template element
const template = element.ownerDocument.createElement('template');
template.content.append(clone);
ignoreAttrs.concat(autoFillIgnoreAttrs).forEach(attribute =>{
clone.removeAttribute(attribute);
});
Expand Down

0 comments on commit 580f15f

Please sign in to comment.