Skip to content

Commit 2515cd2

Browse files
Upstream internal error suppression.
Co-authored-by: Phil Harnish <[email protected]>
1 parent 532454a commit 2515cd2

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

lib/utils/gestures.js

+13-6
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,20 @@ function matchingLabels(el) {
143143
// as the mouseCancellor code will handle ancstor labels
144144
if (!labels.length) {
145145
labels = [];
146-
let root = el.getRootNode();
147-
// if there is an id on `el`, check for all labels with a matching `for` attribute
148-
if (el.id) {
149-
let matching = root.querySelectorAll(`label[for = ${el.id}]`);
150-
for (let i = 0; i < matching.length; i++) {
151-
labels.push(/** @type {!HTMLLabelElement} */(matching[i]));
146+
try {
147+
let root = el.getRootNode();
148+
// if there is an id on `el`, check for all labels with a matching `for` attribute
149+
if (el.id) {
150+
let matching = root.querySelectorAll(`label[for = ${el.id}]`);
151+
for (let i = 0; i < matching.length; i++) {
152+
labels.push(/** @type {!HTMLLabelElement} */(matching[i]));
153+
}
152154
}
155+
} catch (e) {
156+
// Either:
157+
// 1. el.getRootNode() failed.
158+
// 2. el.id cannot be used in `querySelectorAll`
159+
// In both cases, do nothing.
153160
}
154161
}
155162
return labels;

0 commit comments

Comments
 (0)