Skip to content

Commit

Permalink
Upstream internal error suppression.
Browse files Browse the repository at this point in the history
Co-authored-by: Phil Harnish <[email protected]>
  • Loading branch information
bicknellr and PhilHarnish committed Nov 17, 2020
1 parent 532454a commit 2515cd2
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 2515cd2

Please sign in to comment.