Skip to content

Commit

Permalink
fix(clipboard): safely access allowedElements
Browse files Browse the repository at this point in the history
  • Loading branch information
arddor authored and marcbachmann committed Mar 7, 2024
1 parent b9b9677 commit 6f67ea1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/clipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6f67ea1

Please sign in to comment.