Skip to content

Commit

Permalink
fix coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
sonnyp committed Nov 4, 2016
1 parent a501732 commit f293e98
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
15 changes: 7 additions & 8 deletions lib/parsers/ltx.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ var SaxLtx = module.exports = function SaxLtx () {
recordStart = undefined
state = STATE_IGNORE_COMMENT
} else if (c === 63 /* ? */) {
console.log('?')
recordStart = undefined
state = STATE_IGNORE_INSTRUCTION
} else if (c <= 32 || c === 47 /* / */ || c === 62 /* > */) {
Expand All @@ -92,18 +91,18 @@ var SaxLtx = module.exports = function SaxLtx () {
break
case STATE_IGNORE_COMMENT:
if (c === 62 /* > */) {
var prev_first = data.charCodeAt(pos-1)
var prev_second = data.charCodeAt(pos-2)
if (prev_first === 45 /* - */ && prev_second === 45 /* - */) {
state = STATE_TEXT
var prevFirst = data.charCodeAt(pos - 1)
var prevSecond = data.charCodeAt(pos - 2)
if (prevFirst === 45 /* - */ && prevSecond === 45 /* - */) {
state = STATE_TEXT
}
}
break
case STATE_IGNORE_INSTRUCTION:
if (c === 62 /* > */) {
var prev = data.charCodeAt(pos-1)
if (prev === 63 /* ? */) {
state = STATE_TEXT
var prev = data.charCodeAt(pos - 1)
if (prev === 63 /* ? */) {
state = STATE_TEXT
}
}
break
Expand Down
10 changes: 5 additions & 5 deletions test/parse-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ parsers.forEach(function (Parser) {
parser.on('comment', function (s) {
events.push({ comment: s })
})
parser.write("<?xml version='1.0'?><!-- <foo></foo><bar></bar> --><root></root>");
assert.deepEqual(events, [
{ start: 'root' , attrs: {} },
{ end: 'root' }
]);
parser.write("<?xml version='1.0'?><!-- <foo></foo><bar></bar> --><root></root>")
assert.deepEqual(events, [
{ start: 'root', attrs: {} },
{ end: 'root' }
])
}
}
}).export(module)
Expand Down

0 comments on commit f293e98

Please sign in to comment.