Skip to content

Commit

Permalink
[parser] still recognize other options in non-xml-mode
Browse files Browse the repository at this point in the history
using the easiest solution (applying DeMorgan).
  • Loading branch information
fb55 committed Jun 5, 2013
1 parent 02f12e2 commit 6e1669f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/Parser.js
Expand Up @@ -99,7 +99,9 @@ Parser.prototype.ontext = function(data){
};

Parser.prototype.onopentagname = function(name){
if(!this._options.xmlMode || this._options.lowerCaseTags) name = name.toLowerCase();
if(!(this._options.xmlMode || "lowerCaseTags" in this._options) || this._options.lowerCaseTags){
name = name.toLowerCase();
}

this._tagname = name;

Expand Down Expand Up @@ -132,7 +134,9 @@ Parser.prototype.onopentagend = function(){
};

Parser.prototype.onclosetag = function(name){
if(!this._options.xmlMode || this._options.lowerCaseTags) name = name.toLowerCase();
if(!(this._options.xmlMode || "lowerCaseTags" in this._options) || this._options.lowerCaseTags){
name = name.toLowerCase();
}
if(this._stack.length && (!(name in emptyTags) || this._options.xmlMode)){
var pos = this._stack.lastIndexOf(name);
if(pos !== -1){
Expand Down Expand Up @@ -163,7 +167,7 @@ Parser.prototype.onselfclosingtag = function(){

Parser.prototype.onattribname = function(name){
if(this._attribname !== "") this.onattribvalue("");
if(!this._options.xmlMode || this._options.lowerCaseAttributeNames){
if(!(this._options.xmlMode || "lowerCaseAttributeNames" in this._options) || this._options.lowerCaseAttributeNames){
name = name.toLowerCase();
}
this._attribname = name;
Expand All @@ -178,7 +182,7 @@ Parser.prototype.onattribvalue = function attribValue(value){
Parser.prototype.ondeclaration = function(value){
if(this._cbs.onprocessinginstruction){
var name = value.split(/\s|\//, 1)[0];
if(!this._options.xmlMode || this._options.lowerCaseTags){
if(!(this._options.xmlMode || "lowerCaseTags" in this._options) || this._options.lowerCaseTags){
name = name.toLowerCase();
}
this._cbs.onprocessinginstruction("!" + name, "!" + value);
Expand All @@ -188,7 +192,7 @@ Parser.prototype.ondeclaration = function(value){
Parser.prototype.onprocessinginstruction = function(value){
if(this._cbs.onprocessinginstruction){
var name = value.split(/\s|\//, 1)[0];
if(!this._options.xmlMode || this._options.lowerCaseTags){
if(!(this._options.xmlMode || "lowerCaseTags" in this._options) || this._options.lowerCaseTags){
name = name.toLowerCase();
}
this._cbs.onprocessinginstruction("?" + name, "?" + value);
Expand Down

0 comments on commit 6e1669f

Please sign in to comment.