| 234 | |
| 235 | /** Whether a `<script>` or `<style>` tag, opening or closing, starts at `at`. */ |
| 236 | const isElementTag = (at: number): boolean => { |
| 237 | const name = source.charCodeAt(at + 1) === Ch.Slash ? at + 2 : at + 1; |
| 238 | const length = source.startsWith('script', name) ? 6 : source.startsWith('style', name) ? 5 : 0; |
| 239 | if (length === 0) return false; |
| 240 | const next = source.charCodeAt(name + length); |
| 241 | return next === Ch.Greater || next === Ch.Slash || next <= 32; |
| 242 | }; |
| 243 | |
| 244 | /** The offset after the quoted JavaScript string at `at`, or -1: a string ends on its own line. */ |
| 245 | const stringEnd = (at: number, quote: number): number => { |