You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Bastian Hofmann <ba...@googlemail.com> on 2010/09/21 13:14:28 UTC

Fwd: Fix for SHINDIG-1412: Internet Explorer does not display external taglibraries in template (issue2203045)

---------- Forwarded message ----------
From:  <ba...@googlemail.com>
Date: 2010/9/21
Subject: Fix for SHINDIG-1412: Internet Explorer does not display
external taglibraries in template (issue2203045)
To: bashofmann@googlemail.com
Cc: reply@codereview.appspotmail.com


Reviewers: ,

Description:
This patches fixes the following issues:

- Internet Explorer does not display tags from external tag libraries in
templates if it's rendered by JavaScript (autoupdate=true) due to
differences in JavaScript DOM parsing
- PHP version does not include external tag libraries into JavaScript at
all

Please review this at http://codereview.appspot.com/2203045/

Affected files:
 features/src/main/javascript/features/opensocial-templates/loader.js
 php/src/gadgets/render/GadgetBaseRenderer.php


Index: php/src/gadgets/render/GadgetBaseRenderer.php
===================================================================
--- php/src/gadgets/render/GadgetBaseRenderer.php       (Revision 999297)
+++ php/src/gadgets/render/GadgetBaseRenderer.php       (Arbeitskopie)
@@ -346,6 +346,11 @@
        $script .= "opensocial.data.DataContext.putDataSet(\"$key\", $data);\n";
      }
    }
+    if ($this->gadget->gadgetSpec->templatesRequireLibraries) {
+      foreach ($this->gadget->gadgetSpec->templatesRequireLibraries
as $url => $library) {
+        $script .= "os.Loader.loadContent(" . json_encode($library) .
", '" . $url . "');\n";
+      }
+    }
    if ($this->gadget->gadgetSpec->templatesDisableAutoProcessing) {
      $script .= "opensocial.template.Container.disableAutoProcessing();\n";
    }
Index: features/src/main/javascript/features/opensocial-templates/loader.js
===================================================================
--- features/src/main/javascript/features/opensocial-templates/loader.js
       (Revision 999297)
+++ features/src/main/javascript/features/opensocial-templates/loader.js
       (Arbeitskopie)
@@ -169,7 +169,12 @@
 * Processes the <Templates> node.
 */
 os.Loader.processTemplatesNode = function(node) {
-  for (var child = node.firstChild; child; child = child.nextSibling) {
+  // since the ie domparse does not return a general parent element
+  // we check here if firstChild is really present
+  if (node.firstChild) {
+    node = node.firstChild;
+  }
+  for (var child = node; child; child = child.nextSibling) {
    if (child.nodeType == DOM_ELEMENT_NODE) {
      var handler = os.Loader.getProcessorFunction_(child.tagName);
      if (handler) {
@@ -295,7 +300,7 @@
        }
      }
    } catch (err) {
-      gadgets.error('Error in stylesheet: ' + rule + ' - ' + e.name +
' - ' + e.message);
+      gadgets.error('Error in stylesheet: ' + rule + ' - ' + err.name
+ ' - ' + err.message);
    }
  }
 };