This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
fix(grunt-utils): insert the core CSS styles without using innerHTML #17014
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Create style elements and modify their text content instead of using
innerHTML
to create the whole<style>
element with its content.That way style insertion done at bootstrap time doesn't interfere with
Trusted Types restrictions in Chrome (https://bit.ly/trusted-types).
Remove the type attribute -
text/css
is default:https://html.spec.whatwg.org/#update-a-style-block.
AngularJS is in LTS mode
We are no longer accepting changes that are not critical bug fixes into this project.
See https://blog.angular.io/stable-angularjs-and-long-term-support-7e077635ee9c for more detail.
Does this PR fix a regression since 1.7.0, a security flaw, or a problem caused by a new browser version?
Yes, Chrome launched Trusted Types in 83, and all AngularJS applications running on pages with
require-trusted-types-for 'script'
CSP directive cause CSP violation at bootstrap time.What is the current behavior? (You can also link to an open issue here)
At bootstrap, AngularJS inserts the
ngCloak
styles usingelement.prepend
with a payload that will trigger setting the style withinnerHTML
.What is the new behavior (if this is a feature change)?
Changed the payload to create an element, and then insert the contents using as inner text instead.
Does this PR introduce a breaking change?
No, the same styles are inserted, in the same place and time.
Please check if the PR fulfills these requirements
It's a grunt script change.