Author: jmorliaguet
Date: Mon Jan 30 22:39:21 2006
New Revision: 2256

Modified:
   cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js
   cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html
   
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/cpsskins_storage_adapters.pt
Log:

- Canvas.createNode() takes a 'text' option to add a text node.

  removed the 'content' option (.innerHTML should not be used if elements are
  created through the DOM)



Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original)
+++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Mon Jan 30 
22:39:21 2006
@@ -388,7 +388,9 @@
     $H(options.attributes).each(function(attr) {
       node.setAttribute(attr[0], attr[1])
     });
-    if (options.content) { node.innerHTML = options.content; }
+    if (options.text) {
+      node.appendChild(document.createTextNode(options.text));
+    }
     return node;
   },
 

Modified: 
cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html
==============================================================================
--- 
cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html   
    (original)
+++ 
cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html   
    Mon Jan 30 22:39:21 2006
@@ -260,6 +260,12 @@
       assertEqual(n3.style.position, "absolute");
       assertEqual(n3.style.display, "none");
       assert(Element.hasClassName(n3, "cssClass"));
+
+      var n4 = Canvas.createNode({
+        tag: "p",
+        text: "Some text",
+      });
+      assertEqual(n4.innerHTML, "Some text");
     }},
 
     testGetModelNode: function() { with(this) {

Modified: 
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/cpsskins_storage_adapters.pt
==============================================================================
--- 
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/cpsskins_storage_adapters.pt
    (original)
+++ 
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/cpsskins_storage_adapters.pt
    Mon Jan 30 22:39:21 2006
@@ -85,17 +85,17 @@
 
         var content = Canvas.createNode({
           tag: "div",
-          classes: "content"
+          classes: "content",
+          text: data.content
         });
-        content.appendChild(document.createTextNode(data.content));
 
         if (data.message) {
           var message = Canvas.createNode({
             tag: "div",
-            classes: "message"
+            classes: "message",
+            text: data.message
           });
           widget.appendChild(message);
-          message.appendChild(document.createTextNode(data.message));
         }
 
         widget.appendChild(input);
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to