[Pkg-javascript-commits] [node-expat] 26/371: xmlDecl callback data is optional

Jonas Smedegaard dr at jones.dk
Sun Feb 28 09:59:41 UTC 2016


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository node-expat.

commit 7e874637ff3e543c07b4f679c70e7d9b66fa9175
Author: Astro <astro at spaceboyz.net>
Date:   Sun May 30 16:04:57 2010 +0200

    xmlDecl callback data is optional
---
 expat.cc | 4 ++--
 test.js  | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/expat.cc b/expat.cc
index d22560c..231d8d9 100644
--- a/expat.cc
+++ b/expat.cc
@@ -244,8 +244,8 @@ private:
     Parser *parser = reinterpret_cast<Parser *>(userData);
 
     /* Trigger event */
-    Handle<Value> argv[3] = { String::New(version),
-                              String::New(encoding),
+    Handle<Value> argv[3] = { version ? String::New(version) : Null(),
+                              encoding ? String::New(encoding) : Null(),
                               Boolean::New(standalone) };
     parser->Emit(sym_xmlDecl, 3, argv);
   }
diff --git a/test.js b/test.js
index d45c6e9..b2cb05a 100644
--- a/test.js
+++ b/test.js
@@ -102,11 +102,15 @@ expect("<r>ß</r>",
 	['endElement', 'r']]);
 expect("<?i like xml?>",
        [['processingInstruction', 'i', 'like xml']]);
+expect("<?dragons?>",
+       [['processingInstruction', 'dragons', '']]);
 expect("<!-- no comment -->",
        [['comment', ' no comment ']]);
 expect("<&", [['error']]);
 expect("<?xml version='1.0' encoding='UTF-8'?>",
        [['xmlDecl', '1.0', 'UTF-8', true]]);
+expect("<?xml version='1.0'?>",
+       [['xmlDecl', '1.0', null, true]]);
 expect(new Buffer('<foo>bar</foo>'),
        [['startElement', 'foo', {}],
 	['text', 'bar'],

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-expat.git



More information about the Pkg-javascript-commits mailing list