Problem/Motivation
Source revision / Target revision radios are conditionally displayed via js/diff.js using inline style display block / none. However, this inline style can be replaced with the hidden global attribute. The requires the 'unsafe-inline' property for sites using a Content-Security-Policy
See for reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cont...
Steps to reproduce
Enable the csp module and do not enable 'unsafe-inline' for style-src
Proposed resolution
Replace inline style on Source revision / Target revision radios with js-hide CSS class that implements !important
Remaining tasks
- Write a merge request
- Review
- Commit
User interface changes
None
API changes
None
Data model changes
None
Issue fork diff-3589000
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
idebr commentedThe merge request replaces inline style on Source revision / Target revision radios with hidden global attribute, so the form is compatible with sites blocking 'unsafe-inline' styles.
I created a follow-up issue to replace jQuery with vanilla js, see #3589451: Replace jQuery usage with vanilla js
Comment #4
idebr commentedThe suggested approach has two limitations:
A better approach is to replace the inline styles with css classes that implement
!importantComment #5
idebr commentedThe proposed resolution is now to replace the inline styles with the js-hide CSS class that implements
!important. The js-hide CSS class is include in the system/base library that can be assumed to be available on the page.Comment #6
idebr commentedComment #8
acbramley commentedThanks!