Skip to content

Commit

Permalink
[tokenizer] more ternaries
Browse files Browse the repository at this point in the history
  • Loading branch information
fb55 committed Aug 2, 2013
1 parent f3fb8d7 commit bf0eaa4
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions lib/Tokenizer.js
Expand Up @@ -233,8 +233,8 @@ Tokenizer.prototype._stateInAttributeValueDoubleQuotes = function (c) {

Tokenizer.prototype._stateInAttributeValueSingleQuotes = function (c) {
if(c === "'"){
this._state = BEFORE_ATTRIBUTE_NAME;
this._emitToken("onattribvalue");
this._state = BEFORE_ATTRIBUTE_NAME;
}
};

Expand All @@ -251,9 +251,9 @@ Tokenizer.prototype._stateInAttributeValueNoQuotes = function (c) {
};

Tokenizer.prototype._stateBeforeDeclaration = function (c) {
if(c === "[") this._state = BEFORE_CDATA_1;
else if(c === "-") this._state = BEFORE_COMMENT;
else this._state = IN_DECLARATION;
this._state = c === "[" ? BEFORE_CDATA_1 :
c === "-" ? BEFORE_COMMENT :
IN_DECLARATION;
};

Tokenizer.prototype._stateInDeclaration = function (c) {
Expand Down Expand Up @@ -415,23 +415,19 @@ Tokenizer.prototype._stateBeforeScript5 = function (c) {
};

Tokenizer.prototype._stateAfterScript1 = function (c) {
if(c === "r" || c === "R") this._state = AFTER_SCRIPT_2;
else this._state = TEXT;
this._state = (c === "r" || c === "R") ? AFTER_SCRIPT_2 : TEXT;
};

Tokenizer.prototype._stateAfterScript2 = function (c) {
if(c === "i" || c === "I") this._state = AFTER_SCRIPT_3;
else this._state = TEXT;
this._state = (c === "i" || c === "I") ? AFTER_SCRIPT_3 : TEXT;
};

Tokenizer.prototype._stateAfterScript3 = function (c) {
if(c === "p" || c === "P") this._state = AFTER_SCRIPT_4;
else this._state = TEXT;
this._state = (c === "p" || c === "P") ? AFTER_SCRIPT_4 : TEXT;
};

Tokenizer.prototype._stateAfterScript4 = function (c) {
if(c === "t" || c === "T") this._state = AFTER_SCRIPT_5;
else this._state = TEXT;
this._state = (c === "t" || c === "T") ? AFTER_SCRIPT_5 : TEXT;
};

Tokenizer.prototype._stateAfterScript5 = function (c) {
Expand Down Expand Up @@ -479,13 +475,11 @@ Tokenizer.prototype._stateBeforeStyle4 = function (c) {
};

Tokenizer.prototype._stateAfterStyle1 = function (c) {
if(c === "y" || c === "Y") this._state = AFTER_STYLE_2;
else this._state = TEXT;
this._state = (c === "y" || c === "Y") ? AFTER_STYLE_2 : TEXT;
};

Tokenizer.prototype._stateAfterStyle2 = function (c) {
if(c === "l" || c === "L") this._state = AFTER_STYLE_3;
else this._state = TEXT;
this._state = (c === "l" || c === "L") ? AFTER_STYLE_3 : TEXT;
};

Tokenizer.prototype._stateAfterStyle3 = function (c) {
Expand Down

0 comments on commit bf0eaa4

Please sign in to comment.