You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by bh...@apache.org on 2010/09/22 14:09:51 UTC
svn commit: r999892 - in /shindig/trunk:
features/src/main/javascript/features/opensocial-templates/compiler.js
features/src/main/javascript/features/opensocial-templates/loader.js
php/src/gadgets/render/GadgetBaseRenderer.php
Author: bhofmann
Date: Wed Sep 22 12:09:51 2010
New Revision: 999892
URL: http://svn.apache.org/viewvc?rev=999892&view=rev
Log:
SHINDIG-1412: fix dynamic inclusion of external tag libraries in internet explorer
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
- Internet Explorer does not process templates with script tags correctly
Modified:
shindig/trunk/features/src/main/javascript/features/opensocial-templates/compiler.js
shindig/trunk/features/src/main/javascript/features/opensocial-templates/loader.js
shindig/trunk/php/src/gadgets/render/GadgetBaseRenderer.php
Modified: shindig/trunk/features/src/main/javascript/features/opensocial-templates/compiler.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/opensocial-templates/compiler.js?rev=999892&r1=999891&r2=999892&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/opensocial-templates/compiler.js (original)
+++ shindig/trunk/features/src/main/javascript/features/opensocial-templates/compiler.js Wed Sep 22 12:09:51 2010
@@ -580,7 +580,9 @@ os.processTextContent_ = function(fromNo
!toNode.getAttribute(os.ATT_customtag) &&
fromNode.firstChild.nodeType == DOM_TEXT_NODE) {
var substitution = os.parseAttribute_(fromNode.firstChild.data);
- if (substitution) {
+ if (toNode.nodeName == "SCRIPT") {
+ toNode.text = os.trimWhitespaceForIE_(fromNode.firstChild.data, true, true);
+ } if (substitution) {
toNode.setAttribute(ATT_content, substitution);
} else {
toNode.appendChild(document.createTextNode(
Modified: shindig/trunk/features/src/main/javascript/features/opensocial-templates/loader.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/opensocial-templates/loader.js?rev=999892&r1=999891&r2=999892&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/opensocial-templates/loader.js (original)
+++ shindig/trunk/features/src/main/javascript/features/opensocial-templates/loader.js Wed Sep 22 12:09:51 2010
@@ -169,7 +169,12 @@ os.Loader.getProcessorFunction_ = functi
* 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 @@ os.Loader.injectStyle = function(cssCode
}
}
} catch (err) {
- gadgets.error('Error in stylesheet: ' + rule + ' - ' + e.name + ' - ' + e.message);
+ gadgets.error('Error in stylesheet: ' + rule + ' - ' + err.name + ' - ' + err.message);
}
}
};
Modified: shindig/trunk/php/src/gadgets/render/GadgetBaseRenderer.php
URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/render/GadgetBaseRenderer.php?rev=999892&r1=999891&r2=999892&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/render/GadgetBaseRenderer.php (original)
+++ shindig/trunk/php/src/gadgets/render/GadgetBaseRenderer.php Wed Sep 22 12:09:51 2010
@@ -346,6 +346,11 @@ abstract class GadgetBaseRenderer extend
$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";
}