Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
Use `in` inside Parser, added note that the output is simplified in
readme
  • Loading branch information
fb55 committed Jan 17, 2012
1 parent 7c1cbc6 commit c9e4b43
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ parser.write("Xyz <script language= javascript>var foo = '<<bar>>';< / script>"
parser.done();
```

Output:
Output (simplified):

```javascript
--> Xyz
Expand Down
4 changes: 2 additions & 2 deletions lib/Parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ var emptyTags = {
};

Parser.prototype._processCloseTag = function(name){
if(this._stack && (!emptyTags[name] || this._options.xmlMode)){
if(this._stack && (!(name in emptyTags) || this._options.xmlMode)){
var pos = this._stack.lastIndexOf(name);
if(pos !== -1)
if(this._cbs.onclosetag){
Expand Down Expand Up @@ -312,7 +312,7 @@ Parser.prototype._processOpenTag = function(name, data){
}

//If tag self-terminates, add an explicit, separate closing tag
if(data.substr(-1) === "/" || (emptyTags[name] && !this._options.xmlMode)){
if(data.substr(-1) === "/" || (name in emptyTags && !this._options.xmlMode)){
if(this._cbs.onclosetag) this._cbs.onclosetag(name);
} else {
if(type !== ElementType.Tag){
Expand Down

0 comments on commit c9e4b43

Please sign in to comment.