[Pkg-javascript-commits] [ltx] 260/469: Fixes issue #17
Jonas Smedegaard
dr at jones.dk
Wed Aug 31 13:03:10 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 175422c76439bc0d58769e79b4b13d9ad3086fd0
Author: Lloyd Watkin <lloyd at evilprofessor.co.uk>
Date: Sat May 18 15:29:49 2013 +0100
Fixes issue #17
---
lib/element.js | 4 ++--
test/element-test.js | 4 ++++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/element.js b/lib/element.js
index 093d4cd..18a1c24 100644
--- a/lib/element.js
+++ b/lib/element.js
@@ -127,8 +127,8 @@ Element.prototype.getChildrenByFilter = function(filter, recursive) {
Element.prototype.getText = function() {
var text = "";
for(var i = 0; i < this.children.length; i++) {
- var child = this.children[i];
- if (typeof child == 'string')
+ var child = this.children[i]
+ if (typeof child == 'string' || typeof child == 'number')
text += child;
}
return text;
diff --git a/test/element-test.js b/test/element-test.js
index e3c94fa..b69615e 100644
--- a/test/element-test.js
+++ b/test/element-test.js
@@ -59,6 +59,10 @@ vows.describe('ltx').addBatch({
var e = new ltx.Element('e');
e.children = [null];
assert.equal(e.toString(), '<e></e>');
+ },
+ 'serialize with integer text': function() {
+ var e = new ltx.Element('e').t(1000)
+ assert.equal(e.getText(), 1000)
}
},
--
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