Add stanza.getText() to retrieve all text nodes joined as a string

Wed, 03 Feb 2010 19:25:46 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Wed, 03 Feb 2010 19:25:46 +0000
changeset 3
2d83fe899f5f
parent 2
b88bcbbe08e1
child 4
67b1d93509d3

Add stanza.getText() to retrieve all text nodes joined as a string

xmpp.js file | annotate | diff | comparison | revisions
--- a/xmpp.js	Wed Feb 03 19:23:45 2010 +0000
+++ b/xmpp.js	Wed Feb 03 19:25:46 2010 +0000
@@ -307,6 +307,13 @@
 		}
 		return null;
 	},
+	
+	getText: function () {
+		var buf = [];
+		for(var i=0;i<this.children.length;i++)
+			if(typeof(this.children[i]) == "string")
+				buf.push(this.children[i]);
+		return buf.join("");
 	}
 }
 

mercurial