-
Notifications
You must be signed in to change notification settings - Fork 262
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
Sanitize dynamic styles #403
Conversation
src/stylesheet-registry.js
Outdated
// Sanitize SSR-ed and client side (style tags) CSS. | ||
// When using optimize for speed we don't need to sanitize | ||
// because we are not inserting markup in the DOM. | ||
if (!this._isBrowser || !this._optimizeForSpeed) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not in the browser? Just curious 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
document.createTextNode
will do the job for us in browser 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!this._isBrowser == server side rendering
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed I can also remove the second !this._optimizeForSpeed
. Client side code should be safe because of document.createTextNode
(dev) and the CSS OM api not injecting DOM (prod)
@timneutkens just released |
@giuseppeg will upgrade in next 🙏 |
We are not going to sanitize dynamic props on the client when using CSSOM API since we don't inject dom/strings.