Ignore DOMExceptions thrown by assigning an invalid dataset property (#2133)

This commit is contained in:
toasted-nutbread 2022-05-14 18:16:13 -04:00 committed by GitHub
parent 8b6f526dc6
commit fd75e91e75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
}
}
}