From 6f67ea1ff90ab471e60c30a7000bdcb8c802c0ac Mon Sep 17 00:00:00 2001 From: Marc Heimgartner Date: Thu, 7 Mar 2024 09:30:57 +0100 Subject: [PATCH] fix(clipboard): safely access allowedElements --- src/clipboard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/clipboard.js b/src/clipboard.js index 3bb32efe..33fdf1fb 100644 --- a/src/clipboard.js +++ b/src/clipboard.js @@ -125,7 +125,7 @@ function conditionalNodeWrap (child, content, options) { // returns string of concatenated attributes e.g. 'target="_blank" rel="nofollow" href="/test.com"' function filterAttributes (nodeName, node) { return Array.from(node.attributes).reduce((attributes, {name, value}) => { - if (allowedElements[nodeName][name] && value) { + if (allowedElements[nodeName]?.[name] && value) { return `${attributes} ${name}="${value}"` } return attributes