(c: number)
| 646 | } |
| 647 | } |
| 648 | private stateBeforeAttrName(c: number): void { |
| 649 | if (c === CharCodes.Gt) { |
| 650 | this.cbs.onopentagend(this.index) |
| 651 | if (this.inRCDATA) { |
| 652 | this.state = State.InRCDATA |
| 653 | } else { |
| 654 | this.state = State.Text |
| 655 | } |
| 656 | this.sectionStart = this.index + 1 |
| 657 | } else if (c === CharCodes.Slash) { |
| 658 | this.state = State.InSelfClosingTag |
| 659 | if ((__DEV__ || !__BROWSER__) && this.peek() !== CharCodes.Gt) { |
| 660 | this.cbs.onerr(ErrorCodes.UNEXPECTED_SOLIDUS_IN_TAG, this.index) |
| 661 | } |
| 662 | } else if (c === CharCodes.Lt && this.peek() === CharCodes.Slash) { |
| 663 | // special handling for </ appearing in open tag state |
| 664 | // this is different from standard HTML parsing but makes practical sense |
| 665 | // especially for parsing intermediate input state in IDEs. |
| 666 | this.cbs.onopentagend(this.index) |
| 667 | this.state = State.BeforeTagName |
| 668 | this.sectionStart = this.index |
| 669 | } else if (!isWhitespace(c)) { |
| 670 | if ((__DEV__ || !__BROWSER__) && c === CharCodes.Eq) { |
| 671 | this.cbs.onerr( |
| 672 | ErrorCodes.UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME, |
| 673 | this.index, |
| 674 | ) |
| 675 | } |
| 676 | this.handleAttrStart(c) |
| 677 | } |
| 678 | } |
| 679 | private handleAttrStart(c: number) { |
| 680 | if (c === CharCodes.LowerV && this.peek() === CharCodes.Dash) { |
| 681 | this.state = State.InDirName |
no test coverage detected