aboutsummaryrefslogtreecommitdiff
path: root/ext/js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2022-05-14 18:16:13 -0400
committerGitHub <noreply@github.com>2022-05-14 18:16:13 -0400
commitfd75e91e7544939faf302caef453a81cef48f420 (patch)
tree41342bb39722d582cdbf99b589c2203d99f14eb2 /ext/js
parent8b6f526dc69094963f7e0e17e72d3e0cdfd3b41a (diff)
Ignore DOMExceptions thrown by assigning an invalid dataset property (#2133)
Diffstat (limited to 'ext/js')
-rw-r--r--ext/js/display/sandbox/structured-content-generator.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/js/display/sandbox/structured-content-generator.js b/ext/js/display/sandbox/structured-content-generator.js
index 5b11965a..0e287dc2 100644
--- a/ext/js/display/sandbox/structured-content-generator.js
+++ b/ext/js/display/sandbox/structured-content-generator.js
@@ -166,7 +166,11 @@ class StructuredContentGenerator {
key = `${key[0].toUpperCase()}${key.substring(1)}`;
}
key = `sc${key}`;
- element.dataset[key] = value;
+ try {
+ element.dataset[key] = value;
+ } catch (e) {
+ // DOMException if key is malformed
+ }
}
}