[Pkg-javascript-commits] [ltx] 301/469: that -> self
Jonas Smedegaard
dr at jones.dk
Wed Aug 31 13:03:19 UTC 2016
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository ltx.
commit 273830c05632165d6492c6d6f2dde738ed3c6f00
Author: Lloyd Watkin <lloyd at evilprofessor.co.uk>
Date: Sun Feb 16 18:47:22 2014 +0000
that -> self
---
lib/parse.js | 90 ++++++++++++++++++++++++++++++------------------------------
1 file changed, 45 insertions(+), 45 deletions(-)
diff --git a/lib/parse.js b/lib/parse.js
index ba9f178..af17af8 100644
--- a/lib/parse.js
+++ b/lib/parse.js
@@ -4,95 +4,95 @@ var events = require('events')
exports.availableSaxParsers = []
-exports.bestSaxParser = null;
+exports.bestSaxParser = null
['./sax_expat.js', './sax_ltx.js', /*'./sax_easysax.js', './sax_node-xml.js',*/ './sax_saxjs.js'].forEach(function(modName) {
- var mod;
+ var mod
try {
- mod = require(modName);
+ mod = require(modName)
} catch (e) {
- /* Silently missing libraries drop; for debug:
- console.error(e.stack || e);
+ /* Silently missing libraries drop for debug:
+ console.error(e.stack || e)
*/
}
if (mod) {
- exports.availableSaxParsers.push(mod);
+ exports.availableSaxParsers.push(mod)
if (!exports.bestSaxParser)
- exports.bestSaxParser = mod;
+ exports.bestSaxParser = mod
}
})
exports.Parser = function(saxParser) {
- events.EventEmitter.call(this);
- var that = this;
+ events.EventEmitter.call(this)
+ var self = this
- var parserMod = saxParser || exports.bestSaxParser;
+ var parserMod = saxParser || exports.bestSaxParser
if (!parserMod)
- throw new Error("No SAX parser available");
- this.parser = new parserMod();
+ throw new Error('No SAX parser available')
+ this.parser = new parserMod()
- var el;
+ var el
this.parser.addListener('startElement', function(name, attrs) {
var child = new DOMElement(name, attrs)
if (!el) {
- el = child;
+ el = child
} else {
- el = el.cnode(child);
+ el = el.cnode(child)
}
- });
+ })
this.parser.addListener('endElement', function(name) {
if (!el) {
/* Err */
} else if (el && name == el.name) {
if (el.parent)
- el = el.parent;
- else if (!that.tree) {
- that.tree = el;
- el = undefined;
+ el = el.parent
+ else if (!self.tree) {
+ self.tree = el
+ el = undefined
}
}
- });
+ })
this.parser.addListener('text', function(str) {
if (el)
- el.t(str);
- });
+ el.t(str)
+ })
this.parser.addListener('error', function(e) {
- that.error = e;
- that.emit('error', e);
- });
-};
-util.inherits(exports.Parser, events.EventEmitter);
+ self.error = e
+ self.emit('error', e)
+ })
+}
+util.inherits(exports.Parser, events.EventEmitter)
exports.Parser.prototype.write = function(data) {
- this.parser.write(data);
-};
+ this.parser.write(data)
+}
exports.Parser.prototype.end = function(data) {
- this.parser.end(data);
+ this.parser.end(data)
if (!this.error) {
if (this.tree)
- this.emit('tree', this.tree);
+ this.emit('tree', this.tree)
else
- this.emit('error', new Error('Incomplete document'));
+ this.emit('error', new Error('Incomplete document'))
}
-};
+}
exports.parse = function(data, saxParser) {
- var p = new exports.Parser(saxParser);
- var result = null, error = null;
+ var p = new exports.Parser(saxParser)
+ var result = null, error = null
p.on('tree', function(tree) {
- result = tree;
- });
+ result = tree
+ })
p.on('error', function(e) {
- error = e;
- });
+ error = e
+ })
- p.write(data);
- p.end();
+ p.write(data)
+ p.end()
if (error)
- throw error;
+ throw error
else
- return result;
-};
+ return result
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/ltx.git
More information about the Pkg-javascript-commits
mailing list