diff stanza.js @ 107:704ce44c1a22

Add several properties to the Lightstring.Stanza object
author Sonny Piers <sonny@fastmail.net>
date Thu, 28 Jun 2012 12:51:04 +0200
parents c06ec02217ee
children 5cb4733c5189
line wrap: on
line diff
--- a/stanza.js
+++ b/stanza.js
@@ -32,4 +32,37 @@ Lightstring.Stanza = function(aStanza) {
 };
 Lightstring.Stanza.prototype.toString = function() {
   return Lightstring.serialize(this.el);
-};
\ No newline at end of file
+};
+
+Object.defineProperty(Lightstring.Stanza.prototype, "from", {
+  get : function(){
+    return this.el.getAttribute('from');
+  },  
+  // set : function(newValue){ bValue = newValue; },  
+  enumerable : true,  
+  configurable : true
+});
+Object.defineProperty(Lightstring.Stanza.prototype, "name", {
+  get : function(){
+    return this.el.localName;
+  },  
+  // set : function(newValue){ bValue = newValue; },  
+  enumerable : true,  
+  configurable : true
+});
+Object.defineProperty(Lightstring.Stanza.prototype, "id", {
+  get : function(){
+    return this.el.getAttribute('id');
+  },  
+  // set : function(newValue){ bValue = newValue; },  
+  enumerable : true,  
+  configurable : true
+});
+Object.defineProperty(Lightstring.Stanza.prototype, "to", {
+  get : function(){
+    return this.el.getAttribute('to');
+  },  
+  // set : function(newValue){ bValue = newValue; },  
+  enumerable : true,  
+  configurable : true
+});
\ No newline at end of file