(source: string)
| 224 | |
| 225 | /** `source` with its `@* … *@` comments blanked, so a commented-out `<script>` is not a script. */ |
| 226 | export function blankRazorComments(source: string): string { |
| 227 | if (!source.includes('@*')) return source; |
| 228 | const out = source.split(''); |
| 229 | for (let at = source.indexOf('@*'); at >= 0; at = source.indexOf('@*', at + 2)) { |
| 230 | const end = source.indexOf('*@', at + 2); |
| 231 | if (end < 0) break; |
| 232 | blank(out, at, end + 2); |
| 233 | at = end; |
| 234 | } |
| 235 | return out.join(''); |
| 236 | } |
| 237 | |
| 238 | /** Whether a `<script>` element's attributes leave it JavaScript: no `type`, or a JavaScript one. */ |
| 239 | export function isJavaScriptBlock(attrs: string): boolean { |
no test coverage detected