You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.
While setting up a project with CSP rules, the console keeps telling me that the browser
"Refused to apply inline style because it violates the following Content Security Policy directive [...] 'unsafe-inline' ".
After a little bit of investigation, I found out that the function "setTransformOrigin" in the textfield component:
/**
* Sets the transform origin given a user's click location.
* @param {!Event} evt
*/
}, {
key: 'setTransformOrigin',
value: function setTransformOrigin(evt) {
var targetClientRect = evt.target.getBoundingClientRect();
var evtCoords = { x: evt.clientX, y: evt.clientY };
var normalizedX = evtCoords.x - targetClientRect.left;
var attributeString = 'transform-origin: ' + normalizedX + 'px center';
this.adapter_.setAttr('style', attributeString);
}
applies the transform-origin property by directly setting style attribute, thus breaking the CSP rule mentioned above.
I was wondering if it is possible to change that function and make it CSP compliant.
The text was updated successfully, but these errors were encountered:
SirAuron
changed the title
setTransformOrigin breaks CSP rule style-src: 'unsafe-inline' [improvement]
[Improvement] setTransformOrigin breaks CSP rule style-src: 'unsafe-inline'
Feb 22, 2018
While setting up a project with CSP rules, the console keeps telling me that the browser
"Refused to apply inline style because it violates the following Content Security Policy directive [...] 'unsafe-inline' ".
After a little bit of investigation, I found out that the function "setTransformOrigin" in the textfield component:
applies the
transform-origin
property by directly setting style attribute, thus breaking the CSP rule mentioned above.I was wondering if it is possible to change that function and make it CSP compliant.
The text was updated successfully, but these errors were encountered: