Author: evan
Date: Wed Sep 24 12:47:30 2008
New Revision: 698704

URL: http://svn.apache.org/viewvc?rev=698704&view=rev
Log:
Patch for SHINDIG-620 - Allow out of orded compilation and use of custom tags

Modified:
    incubator/shindig/trunk/features/opensocial-templates/base.js
    incubator/shindig/trunk/features/opensocial-templates/compiler.js
    incubator/shindig/trunk/features/opensocial-templates/namespaces.js

Modified: incubator/shindig/trunk/features/opensocial-templates/base.js
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-templates/base.js?rev=698704&r1=698703&r2=698704&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-templates/base.js (original)
+++ incubator/shindig/trunk/features/opensocial-templates/base.js Wed Sep 24 
12:47:30 2008
@@ -220,7 +220,8 @@
 os.doTag = function(node, ns, tag, data, context) {
   var tagFunction = os.getCustomTag(ns, tag);
   if (!tagFunction) {
-    throw "Custom tag <" + ns + ":" + tag + "> not defined.";
+    os.warn("Custom tag <" + ns + ":" + tag + "> not defined.");
+    return;
   }
   
   // Process tag's inner content before processing the tag.

Modified: incubator/shindig/trunk/features/opensocial-templates/compiler.js
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-templates/compiler.js?rev=698704&r1=698703&r2=698704&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-templates/compiler.js (original)
+++ incubator/shindig/trunk/features/opensocial-templates/compiler.js Wed Sep 
24 12:47:30 2008
@@ -429,20 +429,19 @@
       output = document.createElement("span");
       output.setAttribute(os.ATT_customtag, node.tagName);
 
-      var custom;
-      if (custom = os.checkCustom_(node.tagName)) {
-        os.appendJSTAttribute_(output, ATT_eval, "os.doTag(this, \"" 
-            + custom[0] + "\", \"" + custom[1] + "\", $this, $context)");
-        var context = node.getAttribute("context") || "$this||true";
-        output.setAttribute(ATT_select, context);
-
-        // For os:Render, create a parent node reference.
-        if (node.tagName == "os:render" || node.tagName == "os:Render" ||
-            node.tagName == "os:renderAll" || node.tagName == "os:RenderAll") {
-          os.appendJSTAttribute_(output, ATT_values, os.VAR_parentnode + ":" +
-              os.VAR_node);
-        }
+      var custom = node.tagName.split(":");
+      os.appendJSTAttribute_(output, ATT_eval, "os.doTag(this, \"" 
+          + custom[0] + "\", \"" + custom[1] + "\", $this, $context)");
+      var context = node.getAttribute("context") || "$this||true";
+      output.setAttribute(ATT_select, context);
+
+      // For os:Render, create a parent node reference.
+      if (node.tagName == "os:render" || node.tagName == "os:Render" ||
+          node.tagName == "os:renderAll" || node.tagName == "os:RenderAll") {
+        os.appendJSTAttribute_(output, ATT_values, os.VAR_parentnode + ":" +
+            os.VAR_node);
       }
+      
       os.copyAttributes_(node, output, node.tagName);
     } else {
       output = os.xmlToHtml_(node);

Modified: incubator/shindig/trunk/features/opensocial-templates/namespaces.js
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-templates/namespaces.js?rev=698704&r1=698703&r2=698704&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-templates/namespaces.js 
(original)
+++ incubator/shindig/trunk/features/opensocial-templates/namespaces.js Wed Sep 
24 12:47:30 2008
@@ -119,25 +119,6 @@
 };
 
 /**
- * Checks if an XML tag corresponds to a known custom function.
- * If so, the namespace and tag name are returned in an array.
- * @param {string} nodeName Name of XML tag.
- * @return {Array.<string>|null}
- */
-os.checkCustom_ = function(nodeName) {
-  var index;
-  if ((index = nodeName.indexOf(':')) < 0) {
-    return null;
-  }
-  var ns = nodeName.substring(0, index);
-  var tag = nodeName.substring(index + 1);
-  if (os.getCustomTag(ns, tag)) {
-    return [ns, tag]; 
-  }
-  return null;
-};
-
-/**
  * Define 'os:renderAll' and 'os:Html' tags and the @onAttach attribute
  */
 os.defineBuiltinTags = function() {


Reply via email to