diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2022-05-14 18:16:13 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-14 18:16:13 -0400 |
commit | fd75e91e7544939faf302caef453a81cef48f420 (patch) | |
tree | 41342bb39722d582cdbf99b589c2203d99f14eb2 /ext/js/display | |
parent | 8b6f526dc69094963f7e0e17e72d3e0cdfd3b41a (diff) |
Ignore DOMExceptions thrown by assigning an invalid dataset property (#2133)
Diffstat (limited to 'ext/js/display')
-rw-r--r-- | ext/js/display/sandbox/structured-content-generator.js | 6 |
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 + } } } |