Look for an end tag. For <title> and <textarea>, also decode entities.
(c: number)
| 423 | |
| 424 | /** Look for an end tag. For <title> and <textarea>, also decode entities. */ |
| 425 | private stateInRCDATA(c: number): void { |
| 426 | if (this.sequenceIndex === this.currentSequence.length) { |
| 427 | if (c === CharCodes.Gt || isWhitespace(c)) { |
| 428 | const endOfText = this.index - this.currentSequence.length |
| 429 | |
| 430 | if (this.sectionStart < endOfText) { |
| 431 | // Spoof the index so that reported locations match up. |
| 432 | const actualIndex = this.index |
| 433 | this.index = endOfText |
| 434 | this.cbs.ontext(this.sectionStart, endOfText) |
| 435 | this.index = actualIndex |
| 436 | } |
| 437 | |
| 438 | this.sectionStart = endOfText + 2 // Skip over the `</` |
| 439 | this.stateInClosingTagName(c) |
| 440 | this.inRCDATA = false |
| 441 | return // We are done; skip the rest of the function. |
| 442 | } |
| 443 | |
| 444 | this.sequenceIndex = 0 |
| 445 | } |
| 446 | |
| 447 | if ((c | 0x20) === this.currentSequence[this.sequenceIndex]) { |
| 448 | this.sequenceIndex += 1 |
| 449 | } else if (this.sequenceIndex === 0) { |
| 450 | if ( |
| 451 | this.currentSequence === Sequences.TitleEnd || |
| 452 | (this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) |
| 453 | ) { |
| 454 | // We have to parse entities in <title> and <textarea> tags. |
| 455 | if (!__BROWSER__ && c === CharCodes.Amp) { |
| 456 | this.startEntity() |
| 457 | } else if (!this.inVPre && c === this.delimiterOpen[0]) { |
| 458 | // We also need to handle interpolation |
| 459 | this.state = State.InterpolationOpen |
| 460 | this.delimiterIndex = 0 |
| 461 | this.stateInterpolationOpen(c) |
| 462 | } |
| 463 | } else if (this.fastForwardTo(CharCodes.Lt)) { |
| 464 | // Outside of <title> and <textarea> tags, we can fast-forward. |
| 465 | this.sequenceIndex = 1 |
| 466 | } |
| 467 | } else { |
| 468 | // If we see a `<`, set the sequence index to 1; useful for eg. `<</script>`. |
| 469 | this.sequenceIndex = Number(c === CharCodes.Lt) |
| 470 | } |
| 471 | } |
| 472 | |
| 473 | private stateCDATASequence(c: number): void { |
| 474 | if (c === Sequences.Cdata[this.sequenceIndex]) { |
no test coverage detected