Skip to content

Commit

Permalink
[tokenizer] always call WritableStream#end
Browse files Browse the repository at this point in the history
  • Loading branch information
fb55 committed Mar 30, 2013
1 parent 1b6a264 commit b48adc2
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/Tokenizer.js
Expand Up @@ -522,12 +522,9 @@ Parser.prototype._write = function(chunk, encoding, cb){
Parser.prototype.end = function(chunk){
if(chunk) this.write(chunk);

if(this._buffer === null || this._sectionStart === -1 || this._sectionStart === this._index - 1){
return;
}

//do something with the remaining data
if(this._state === IN_CDATA || this._state === CDATA_END_1 || this._state === CDATA_END_2){
//if there is remaining data, emit it in a reasonable way
if(this._buffer === null || this._sectionStart === -1 || this._sectionStart === this._index - 1);
else if(this._state === IN_CDATA || this._state === CDATA_END_1 || this._state === CDATA_END_2){
this._emitIfToken("cdata");
} else if(this._state === IN_COMMENT || this._state === COMMENT_END_1 || this._state === COMMENT_END_2){
this._emitIfToken("comment");
Expand Down

0 comments on commit b48adc2

Please sign in to comment.