Skip to content

Commit

Permalink
core: save native HTMLElement.prototype.matches function to avoid con…
Browse files Browse the repository at this point in the history
…flict (#5934)_
  • Loading branch information
connorjclark committed Oct 15, 2018
1 parent 2b12fc2 commit f984ab1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lighthouse-core/gather/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,8 @@ class Driver {
async cacheNatives() {
await this.evaluateScriptOnNewDocument(`window.__nativePromise = Promise;
window.__nativeError = Error;
window.__nativeURL = URL;`);
window.__nativeURL = URL;
HTMLElement.prototype.__matches = HTMLElement.prototype.matches;`);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/lib/page-functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function getElementsInDocument(selector) {
/** @param {NodeListOf<Element>} nodes */
const _findAllElements = nodes => {
for (let i = 0, el; el = nodes[i]; ++i) {
if (!selector || el.matches(selector)) {
if (!selector || el.__matches(selector)) {
results.push(el);
}
// If the element has a shadow root, dig deeper.
Expand Down

0 comments on commit f984ab1

Please sign in to comment.