Skip to content

Commit

Permalink
Merge pull request #5675 from Polymer/upstream-error-suppression
Browse files Browse the repository at this point in the history
Upstream internal error suppression.
  • Loading branch information
kevinpschaaf authored Nov 19, 2020
2 parents 532454a + 2515cd2 commit 17720d0
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions lib/utils/gestures.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,20 @@ function matchingLabels(el) {
// as the mouseCancellor code will handle ancstor labels
if (!labels.length) {
labels = [];
let root = el.getRootNode();
// if there is an id on `el`, check for all labels with a matching `for` attribute
if (el.id) {
let matching = root.querySelectorAll(`label[for = ${el.id}]`);
for (let i = 0; i < matching.length; i++) {
labels.push(/** @type {!HTMLLabelElement} */(matching[i]));
try {
let root = el.getRootNode();
// if there is an id on `el`, check for all labels with a matching `for` attribute
if (el.id) {
let matching = root.querySelectorAll(`label[for = ${el.id}]`);
for (let i = 0; i < matching.length; i++) {
labels.push(/** @type {!HTMLLabelElement} */(matching[i]));
}
}
} catch (e) {
// Either:
// 1. el.getRootNode() failed.
// 2. el.id cannot be used in `querySelectorAll`
// In both cases, do nothing.
}
}
return labels;
Expand Down

0 comments on commit 17720d0

Please sign in to comment.