ondirarg(start: number, endIndex: number): void
ondirmodifier(start: number, endIndex: number): void
- oncomment(start: number, endIndex: number, endOffset: number): void
- oncdata(start: number, endIndex: number, endOffset: number): void
+ oncomment(start: number, endIndex: number): void
+ oncdata(start: number, endIndex: number): void
// onprocessinginstruction(start: number, endIndex: number): void
// ondeclaration(start: number, endIndex: number): void
if (c === this.currentSequence[this.sequenceIndex]) {
if (++this.sequenceIndex === this.currentSequence.length) {
if (this.currentSequence === Sequences.CdataEnd) {
- this.cbs.oncdata(this.sectionStart, this.index, 2)
+ this.cbs.oncdata(this.sectionStart, this.index - 2)
} else {
- this.cbs.oncomment(this.sectionStart, this.index, 2)
+ this.cbs.oncomment(this.sectionStart, this.index - 2)
}
this.sequenceIndex = 0
}
private stateInSpecialComment(c: number): void {
if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {
- this.cbs.oncomment(this.sectionStart, this.index, 0)
+ this.cbs.oncomment(this.sectionStart, this.index)
this.state = State.Text
this.sectionStart = this.index + 1
}
if (this.state === State.InCommentLike) {
if (this.currentSequence === Sequences.CdataEnd) {
- this.cbs.oncdata(this.sectionStart, endIndex, 0)
+ this.cbs.oncdata(this.sectionStart, endIndex)
} else {
- this.cbs.oncomment(this.sectionStart, endIndex, 0)
+ this.cbs.oncomment(this.sectionStart, endIndex)
}
} else if (
this.state === State.InTagName ||
currentAttrStartIndex = currentAttrEndIndex = -1
},
- oncomment(start, end, offset) {
- // TODO oncomment
+ oncomment(start, end) {
+ if (currentOptions.comments) {
+ addNode({
+ type: NodeTypes.COMMENT,
+ content: getSlice(start, end),
+ loc: getLoc(start - 4, end + 3)
+ })
+ }
},
onend() {
}
},
- oncdata(start, end, offset) {
+ oncdata(start, end) {
// TODO throw error
}
})