diff sxe-document.js @ 8:7b2ca4d5af6d

Add a resend-whole-state button and make it works.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Thu, 02 Feb 2012 15:45:25 +0100
parents 24aa8dccb170
children
line wrap: on
line diff
--- a/sxe-document.js
+++ b/sxe-document.js
@@ -25,6 +25,7 @@ var Document = function(initiator, name,
   this.initiator = initiator;
   this.name = name;
   this.host = host;
+  this.participants = {};
 
   this.prolog = prolog || 'data:application/xhtml+xml,%3C%3Fxml%20version%3D%271.0%27%3F%3E%0A%3C%21DOCTYPE%20html%3E%0A';
   this.state = 'not-started';
@@ -87,8 +88,8 @@ Document.prototype = {
     var i = 0;
     var first = elements[0];
     if (first.localName === 'document-begin') {
-      if (this.state !== 'not-started')
-        return; //TODO: the session has already started.
+      /*if (this.state !== 'not-started')
+        return;*/ //TODO: the session has already started.
       i = 1;
       this.prolog = first.getAttributeNS(null, 'prolog');
       this.state = 'getting-session';
@@ -123,7 +124,7 @@ Document.prototype = {
 
     for (var i = 0; i < children.length; i++) {
       var child = children[i];
-      var element = document.createElementNS(Lightstring.NS.sxe, 'new');
+      var element = document.createElementNS(Lightstring.ns['sxe'], 'new');
       var rid = Lightstring.newId('GUID');
       element.setAttributeNS(null, 'rid', rid);
 
@@ -139,7 +140,7 @@ Document.prototype = {
 
           //TODO: move that elsewhere, or make it prettier.
           var convertAttr = function(attr) {
-            var element = document.createElementNS(Lightstring.NS.sxe, 'new');
+            var element = document.createElementNS(Lightstring.ns['sxe'], 'new');
             element.setAttributeNS(null, 'type', 'attr');
             var arid = Lightstring.newId('GUID');
             element.setAttributeNS(null, 'rid', arid);