Skip to content

Commit 24534c9

Browse files
committed
More descriptive comments and readability changes.
1 parent 464db37 commit 24534c9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/angular/build/src/utils/index-file/auto-csp.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,10 @@ export async function autoCsp(html: string): Promise<string> {
142142
}
143143
}
144144
// We are encountering the first start tag that's not <script src="..."> after a string of
145-
// consecutive <script src="...">. The first place when we can determine this to be the case is
145+
// consecutive <script src="...">. <script> tags without a src attribute will also end a chain
146+
// of src attributes that can be loaded in a single loader script, so those will end up here.
147+
//
148+
// The first place when we can determine this to be the case is
146149
// during the first opening tag that's not <script src="...">, where we need to insert the
147150
// dynamic loader script before continuing on with writing the rest of the tags.
148151
// (One edge case is where there are no more opening tags after the last <script src="..."> is
@@ -280,7 +283,7 @@ function createLoaderScript(srcList: SrcScriptTag[], enableTrustedTypes = false)
280283
const srcListFormatted = srcList
281284
.map(
282285
(s) =>
283-
`['${encodeURI(s.src).replaceAll("'", "\\'")}', ${s.type ? "'" + encodeURI(s.type) + "'" : undefined}, ${s.async ? 'true' : 'false'}, ${s.defer ? 'true' : 'false'}]`,
286+
`['${encodeURI(s.src).replaceAll("'", "\\'")}', ${s.type ? "'" + s.type + "'" : undefined}, ${s.async ? 'true' : 'false'}, ${s.defer ? 'true' : 'false'}]`,
284287
)
285288
.join();
286289
return enableTrustedTypes

0 commit comments

Comments
 (0)