Skip to content

Commit

Permalink
[tokenizer] even more ternaries
Browse files Browse the repository at this point in the history
  • Loading branch information
fb55 committed Aug 2, 2013
1 parent 7f9082c commit 4bc1ec4
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions lib/Tokenizer.js
Expand Up @@ -351,12 +351,9 @@ Tokenizer.prototype._stateBeforeSpecial = function (c) {
};

Tokenizer.prototype._stateBeforeSpecialEnd = function (c) {
if(this._special === SPECIAL_SCRIPT && (c === "c" || c === "C")){
this._state = AFTER_SCRIPT_1;
} else if(this._special === SPECIAL_STYLE && (c === "t" || c === "T")){
this._state = AFTER_STYLE_1;
}
else this._state = TEXT;
this._state = (this._special === SPECIAL_SCRIPT && (c === "c" || c === "C")) ?
AFTER_SCRIPT_1 : (this._special === SPECIAL_STYLE && (c === "t" || c === "T")) ?
AFTER_STYLE_1 : TEXT;
};

Tokenizer.prototype._stateBeforeScript1 = function (c) {
Expand Down Expand Up @@ -396,10 +393,7 @@ Tokenizer.prototype._stateBeforeScript4 = function (c) {
};

Tokenizer.prototype._stateBeforeScript5 = function (c) {
if(c === "/" || c === ">" || whitespace(c)){
this._special = SPECIAL_SCRIPT;
}
this._state = IN_TAG_NAME;
this._state = (c === "/" || c === ">" || whitespace(c)) ? SPECIAL_SCRIPT : IN_TAG_NAME;
this._index--; //consume the token again
};

Expand Down Expand Up @@ -456,10 +450,7 @@ Tokenizer.prototype._stateBeforeStyle3 = function (c) {
};

Tokenizer.prototype._stateBeforeStyle4 = function (c) {
if(c === "/" || c === ">" || whitespace(c)){
this._special = SPECIAL_STYLE;
}
this._state = IN_TAG_NAME;
this._state = (c === "/" || c === ">" || whitespace(c)) ? SPECIAL_STYLE : IN_TAG_NAME;
this._index--; //consume the token again
};

Expand Down

0 comments on commit 4bc1ec4

Please sign in to comment.