[Pkg-javascript-commits] [ltx] 56/469: xml.js: documentation

Jonas Smedegaard dr at jones.dk
Wed Aug 31 13:01:00 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 097df659c380b33d9be472415a4ff70932c36c20
Author: Astro <astro at spaceboyz.net>
Date:   Sat Aug 14 00:56:40 2010 +0200

    xml.js: documentation
---
 lib/xmpp/xml.js | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/lib/xmpp/xml.js b/lib/xmpp/xml.js
index 765cd0f..2bd2576 100644
--- a/lib/xmpp/xml.js
+++ b/lib/xmpp/xml.js
@@ -1,4 +1,9 @@
-/** This cheap replica of DOM/Builder puts me to shame :-) */
+/**
+ * This cheap replica of DOM/Builder puts me to shame :-)
+ *
+ * Attributes are in the element.attrs object. Children is a list of
+ * either other Elements or Strings for text content.
+ **/
 function Element(name, attrs) {
     this.name = name;
     this.parent = null;
@@ -8,6 +13,9 @@ function Element(name, attrs) {
 
 /*** Accessors ***/
 
+/**
+ * if (element.is('message', 'jabber:client')) ...
+ **/
 Element.prototype.is = function(name, xmlns) {
     return this.getName() == name &&
 	(!xmlns || this.getNS() == xmlns);
@@ -21,6 +29,9 @@ Element.prototype.getName = function() {
 	return this.name;
 };
 
+/**
+ * retrieves the namespace of the current element, upwards recursively
+ **/
 Element.prototype.getNS = function() {
     if (this.name.indexOf(":") >= 0) {
 	var prefix = this.name.substr(0, this.name.indexOf(":"));
@@ -30,6 +41,9 @@ Element.prototype.getNS = function() {
     }
 };
 
+/**
+ * find the namespace to the given prefix, upwards recursively
+ **/
 Element.prototype.findNS = function(prefix) {
     if (!prefix) {
 	/* default namespace */
@@ -47,11 +61,15 @@ Element.prototype.findNS = function(prefix) {
     }
 };
 
-/** xmlns can be null */
+/**
+ * xmlns can be null
+ **/
 Element.prototype.getChild = function(name, xmlns) {
     return this.getChildren(name, xmlns)[0];
 };
-
+/**
+ * xmlns can be null
+ **/
 Element.prototype.getChildren = function(name, xmlns) {
     var result = [];
     this.children.forEach(function(child) {

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