Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add style attribute condition for compat with CSP: unsafe-inline style #243

Open
woody-li opened this issue Aug 30, 2023 · 0 comments
Open

Comments

@woody-li
Copy link

If CSP enable, and not set unsafe-inline style, the setAttribute for style will got an error.

Suggest add a style sttribute condition for it:
https://github.com/patrick-steele-idem/morphdom/blob/master/src/morphAttrs.js#L37

// from
fromNode.setAttribute(attrName, attrValue);

// to
if( attrName === 'style' ){
  fromNode.style.cssText = attrValue;
} else {
  fromNode.setAttribute(attrName, attrValue);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant