aboutsummaryrefslogtreecommitdiffstats
path: root/lib/sax.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sax.js')
-rw-r--r--lib/sax.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/sax.js b/lib/sax.js
index 15cd7a2..63ae844 100644
--- a/lib/sax.js
+++ b/lib/sax.js
@@ -70,6 +70,8 @@ function SAXParser (strict, opt) {
// mostly just for error reporting
parser.position = parser.line = parser.column = 0
emit(parser, "onready")
+
+ return this;
}
function checkBufferLength (parser) {
@@ -169,11 +171,14 @@ function SAXStream (strict, opt) {
return me._parser["on"+ev] = h
}
me.on(ev, h)
+ return null;
},
enumerable: true,
configurable: false
})
})
+
+ return this;
}
SAXStream.prototype = Object.create(Stream.prototype,
@@ -572,7 +577,7 @@ function write (chunk) {
"Cannot write after close. Assign an onready handler.")
if (chunk === null) return end(parser)
var i = 0, c = ""
- while (parser.c = c = chunk.charAt(i++)) {
+ while ((parser.c = c = chunk.charAt(i++))) {
parser.position ++
if (c === "\n") {
parser.line ++