Skip to content

Commit

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

const clone = element.cloneNode();
// Prevent any potential side-effects by appending to a template element.
// See https://github.com/GoogleChrome/lighthouse/issues/11465
const template = element.ownerDocument.createElement('template');
template.content.append(clone);
ignoreAttrs.concat(autoFillIgnoreAttrs).forEach(attribute =>{
clone.removeAttribute(attribute);
});
Expand Down

0 comments on commit 925cb1d

Please sign in to comment.