Summary: Updates country container styling to apply left or right styles using DOM style properties, rather than applying styles through an inline style attribute.
Context:
When trying to upgrade to the latest version of intl-tel-input in our project, I started noticing the following errors in the console:
Refused to apply inline style because it violates the following Content Security Policy directive: "style-src 'self' 'unsafe-inline' 'nonce-...'". Note that 'unsafe-inline' is ignored if either a hash or nonce value is present in the source list.
For the purpose of how intl-tel-input is applying these styles, it's simple enough to swap the style attribute with style property assignments.
From the above MDN resource:
styles properties that are set directly on the element's style property will not be blocked, allowing users to safely manipulate styles via JavaScript:
This also appears to be the only inline style attribute applied in the project, and there are several other instances of direct style property assignment (example).
Included are regression specs which pass before and after the change, included to increase confidence in changes.
Summary: Updates country container styling to apply
left
orright
styles using DOMstyle
properties, rather than applying styles through an inlinestyle
attribute.Context:
When trying to upgrade to the latest version of
intl-tel-input
in our project, I started noticing the following errors in the console:Our application enforces a content security policy (CSP), which disallows inline style attributes by default (see
style-src
unsafe-inline
reference).For the purpose of how
intl-tel-input
is applying these styles, it's simple enough to swap thestyle
attribute withstyle
property assignments.From the above MDN resource:
This also appears to be the only inline style attribute applied in the project, and there are several other instances of direct style property assignment (example).
Included are regression specs which pass before and after the change, included to increase confidence in changes.