shindig-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Lindner (JIRA)" <j...@apache.org>
Subject [jira] Commented: (SHINDIG-1241) Invalid style elements in custom templates cause opensocial-templates to break
Date Wed, 02 Dec 2009 13:52:20 GMT

    [ https://issues.apache.org/jira/browse/SHINDIG-1241?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12784824#action_12784824
] 

Paul Lindner commented on SHINDIG-1241:
---------------------------------------

diff --git a/features/src/main/javascript/features/opensocial-templates/loader.js b/features/src/main/javascript/features/opensocial-templates/lo
index eb366c3..59f3f8b 100644
--- a/features/src/main/javascript/features/opensocial-templates/loader.js
+++ b/features/src/main/javascript/features/opensocial-templates/loader.js
@@ -276,14 +276,18 @@ os.Loader.injectStyle = function(cssCode) {
   var rules = cssCode.split("}");
   for (var i = 0; i < rules.length; i++) {
     var rule = rules[i].replace(/\n/g, "").replace(/\s+/g, " ");
-    if (rule.length > 2) {
-      if (sheet.insertRule) {
-        rule = rule + "}";
-        sheet.insertRule(rule, sheet.cssRules.length);
-      } else {
-        var ruleParts = rule.split("{");
-        sheet.addRule(ruleParts[0], ruleParts[1]);
+    try {
+      if (rule.length > 2) {
+        if (sheet.insertRule) {
+          rule = rule + "}";
+            sheet.insertRule(rule, sheet.cssRules.length);
+        } else {
+          var ruleParts = rule.split("{");
+          sheet.addRule(ruleParts[0], ruleParts[1]);
+        }
       }
+    } catch (err) {
+      gadgets.error("Error in stylesheet: " + rule + " - " + e.name + " - " + e.message);
     }
   }
 };



> Invalid style elements in custom templates cause opensocial-templates to break
> ------------------------------------------------------------------------------
>
>                 Key: SHINDIG-1241
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1241
>             Project: Shindig
>          Issue Type: Bug
>          Components: Javascript 
>    Affects Versions: 1.1-BETA5
>            Reporter: Paul Lindner
>
> If you have a opensocial template library like this:
> <?xml version="1.0" encoding="UTF-8"?>
> <Templates xmlns:ext-li="http://www.linkedin.com/ext-li">
>   <Namespace prefix="ext-li" url="http://www.linkedin.com/ext-li"/>
>   <Style>
>     large-font: {
>       font-size: 20px;
>     }
>   </Style>
>   <JavaScript>
>     function global(a) {
>       a.innerHTML += 'global';
>     }
>   </JavaScript>
> ....
> And the style is invalid, then you will end up with DOM error 12 due to invalid CSS.
 
> In the case above there is an extra colon between the selector and the style  'large-font
: ....'
> We should catch this condition, log it, and soldier on..

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message