Skip to content

Commit

Permalink
fix: csp violation for style attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
falric authored and mthege committed Aug 31, 2023
1 parent d2f8418 commit a90781d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/consent-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,12 @@ export default class ConsentManager {
// place, as the script won't start correctly otherwise
const newElement = document.createElement(element.tagName)
for(const attribute of element.attributes){
newElement.setAttribute(attribute.name, attribute.value)
if (attribute.name === 'style') {
const [styleProperty, styleValue] = attribute.value.split(':')
newElement.style[styleProperty.trim()] = styleValue.trim()
} else {
newElement.setAttribute(attribute.name, attribute.value)
}
}
newElement.innerText = element.innerText
newElement.text = element.text
Expand Down

0 comments on commit a90781d

Please sign in to comment.