Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed nested calls to text()

  • Loading branch information...
commit 569e22676bf6fbda24db806186612b72881ad878 1 parent d3169e0
@teknopaul authored
Showing with 4 additions and 3 deletions.
  1. +1 −0  example/test-dom-js.js
  2. +1 −1  lib/dom-js.js
  3. +2 −2 package.json
View
1  example/test-dom-js.js
@@ -9,6 +9,7 @@ console.log(string);
domjs.parse(string, function(err, dom) {
console.log(util.inspect(dom, false, 23));
console.log("serializes to : " + dom.toXml());
+ console.log("dom.children[1].text() : " + dom.children[1].text());
});
domjs.reset(); //before reuse
View
2  lib/dom-js.js
@@ -149,7 +149,7 @@ Element = function(name, attributes, children ) {
this.text = function() {
if ( this.children.length > 0) {
- if (this.children[0].text) {
+ if (typeof this.children[0].text == 'string') {
return this.children[0].text;
};
}
View
4 package.json
@@ -1,6 +1,6 @@
{
"name": "dom-js",
- "version": "0.0.2",
+ "version": "0.0.3",
"description" : "XML DOM based on sax",
"dependencies": {
"sax": ">=0.1.5"
@@ -12,4 +12,4 @@
"engines": {
"node": "*"
}
-}
+}
Please sign in to comment.
Something went wrong with that request. Please try again.