[Pkg-javascript-commits] [ltx] 271/469: sax_ltx: fix attrName scope + test

Jonas Smedegaard dr at jones.dk
Wed Aug 31 13:03:11 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 1bbcd83605d3b9e27fb7d2fee28c9a0e4c5f16d2
Author: Astro <astro at spaceboyz.net>
Date:   Tue Nov 12 23:03:23 2013 +0100

    sax_ltx: fix attrName scope + test
---
 lib/sax_ltx.js     | 2 +-
 test/parse-test.js | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/sax_ltx.js b/lib/sax_ltx.js
index 394239f..be1577f 100644
--- a/lib/sax_ltx.js
+++ b/lib/sax_ltx.js
@@ -19,12 +19,12 @@ var SaxLtx = module.exports = function SaxLtx() {
     var state = STATE_TEXT, remainder;
     var tagName, attrs, endTag, selfClosing, attrQuote;
     var recordStart = 0;
+    var attrName;
 
     this.write = function(data) {
 	if (typeof data !== 'string')
 	    data = data.toString();
         var pos = 0
-        var attrName
 
 	/* Anything from previous write()? */
 	if (remainder) {
diff --git a/test/parse-test.js b/test/parse-test.js
index a9c0b44..c9fcad1 100644
--- a/test/parse-test.js
+++ b/test/parse-test.js
@@ -68,8 +68,8 @@ ltx.availableSaxParsers.forEach(function(saxParser) {
 	    'XMPP stream': function() {
 		var parser = new saxParser();
 		var events = [];
-		parser.on('startElement', function(name) {
-		    events.push({ start: name });
+		parser.on('startElement', function(name, attrs) {
+		    events.push({ start: name, attrs: attrs });
 		});
 		parser.on('endElement', function(name) {
 		    events.push({ end: name });
@@ -82,6 +82,9 @@ ltx.availableSaxParsers.forEach(function(saxParser) {
 		assert.equal(events.length, 0);
 		parser.write("90365' from='jabber.ccc.de' version='1.0' xml:lang='en'><");
 		assert.equal(events.length, 1);
+		assert.equal(events[0].start, 'stream:stream');
+		assert.equal(events[0].attrs.xmlns, 'jabber:client');
+		assert.equal(events[0].attrs.id, '556890365');
 		parser.write("stream:features><starttls xmlns='urn:ietf:params:xml:ns:x");
 		assert.equal(events.length, 2);
 		parser.write("mpp-tls'/><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-");

-- 
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