Handle any trailing data.
()
| 1128 | |
| 1129 | /** Handle any trailing data. */ |
| 1130 | private handleTrailingData() { |
| 1131 | const endIndex = this.buffer.length |
| 1132 | |
| 1133 | // If there is no remaining data, we are done. |
| 1134 | if (this.sectionStart >= endIndex) { |
| 1135 | return |
| 1136 | } |
| 1137 | |
| 1138 | if (this.state === State.InCommentLike) { |
| 1139 | if (this.currentSequence === Sequences.CdataEnd) { |
| 1140 | this.cbs.oncdata(this.sectionStart, endIndex) |
| 1141 | } else { |
| 1142 | this.cbs.oncomment(this.sectionStart, endIndex) |
| 1143 | } |
| 1144 | } else if ( |
| 1145 | this.state === State.InTagName || |
| 1146 | this.state === State.BeforeAttrName || |
| 1147 | this.state === State.BeforeAttrValue || |
| 1148 | this.state === State.AfterAttrName || |
| 1149 | this.state === State.InAttrName || |
| 1150 | this.state === State.InDirName || |
| 1151 | this.state === State.InDirArg || |
| 1152 | this.state === State.InDirDynamicArg || |
| 1153 | this.state === State.InDirModifier || |
| 1154 | this.state === State.InAttrValueSq || |
| 1155 | this.state === State.InAttrValueDq || |
| 1156 | this.state === State.InAttrValueNq || |
| 1157 | this.state === State.InClosingTagName |
| 1158 | ) { |
| 1159 | /* |
| 1160 | * If we are currently in an opening or closing tag, us not calling the |
| 1161 | * respective callback signals that the tag should be ignored. |
| 1162 | */ |
| 1163 | } else { |
| 1164 | this.cbs.ontext(this.sectionStart, endIndex) |
| 1165 | } |
| 1166 | } |
| 1167 | |
| 1168 | private emitCodePoint(cp: number, consumed: number): void { |
| 1169 | if (!__BROWSER__) { |