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

Fix issues on websites with strict CSP #400

Closed
wants to merge 5 commits into from

Conversation

MomoTheTanuki
Copy link

Replacing element.setAttribute('style', styles); with element.style.cssText = styles; allows the styles to be loaded without errors on websites with strict Content-Security-Policy. It has been tested on Chrome 77, Firefox 65, Microsoft Edge 42.17134 and Internet Explorer 11. Also this actually allows the widget to load a lot faster according to performance tab in Chrome's dev console (CPU was set to 4x slowdown). Instead of taking ~300ms to load it takes ~68ms (at least on my work laptop).

Replacing `element.setAttribute('style', styles);` with `element.style.cssText = styles;` to allow Filepond usage on website with strict CSP.
Replacing `element.setAttribute('style', styles);` with `element.style.cssText = styles;` to allow usage of Filepond on websites with strict CSP.
Replacing `element.setAttribute('style', styles);` with `element.style.cssText = styles;` to allow usage of Filepond on websites with strict CSP.
Replacing `element.setAttribute('style', styles);` with `element.style.cssText = styles;` to allow usage of Filepond on websites with strict CSP.
Replacing `element.setAttribute('style', styles);` with `element.style.cssText = styles;` to allow usage of Filepond on websites with strict CSP.
@rikschennink
Copy link
Collaborator

#377

@rikschennink
Copy link
Collaborator

Thanks, I'm looking into this now.

@rikschennink
Copy link
Collaborator

rikschennink commented Oct 28, 2019

I've set up a test comparing cssText vs setAttribute and indeed cssText seems faster ( https://jsperf.com/csstext-vs-setattribute-style ), will switch. However I can't merge this PR as the change hasn't been made in the source code.

@MomoTheTanuki
Copy link
Author

Yea, I see I did a goof there. I will close this PR then.

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

Successfully merging this pull request may close these issues.

2 participants