Return-Path: Delivered-To: apmail-incubator-shindig-issues-archive@minotaur.apache.org Received: (qmail 33682 invoked from network); 2 Dec 2009 13:52:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 2 Dec 2009 13:52:44 -0000 Received: (qmail 62008 invoked by uid 500); 2 Dec 2009 13:52:43 -0000 Delivered-To: apmail-incubator-shindig-issues-archive@incubator.apache.org Received: (qmail 61912 invoked by uid 500); 2 Dec 2009 13:52:43 -0000 Mailing-List: contact shindig-issues-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: shindig-dev@incubator.apache.org Delivered-To: mailing list shindig-issues@incubator.apache.org Received: (qmail 61894 invoked by uid 99); 2 Dec 2009 13:52:43 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Dec 2009 13:52:43 +0000 X-ASF-Spam-Status: No, hits=-10.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Dec 2009 13:52:40 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id BEE50234C4AA for ; Wed, 2 Dec 2009 05:52:20 -0800 (PST) Message-ID: <527998636.1259761940780.JavaMail.jira@brutus> Date: Wed, 2 Dec 2009 13:52:20 +0000 (UTC) From: "Paul Lindner (JIRA)" To: shindig-issues@incubator.apache.org Subject: [jira] Commented: (SHINDIG-1241) Invalid style elements in custom templates cause opensocial-templates to break In-Reply-To: <820909271.1259759182175.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ 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: > > > > > > function global(a) { > a.innerHTML += 'global'; > } > > .... > 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.