This is an automated email from the ASF dual-hosted git repository. greg-dove pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit 51ee2c3bcf788bcaba33de367b85072b8e69e370 Author: greg-dove <[email protected]> AuthorDate: Fri Apr 24 17:18:50 2026 +1200 stylebead changes - permit use of calc in value/selector combo, Allow nested AttributeState/DataState styling. --- .../royale/org/apache/royale/style/stylebeads/LeafStyleBase.as | 8 +++++--- .../royale/style/stylebeads/states/attribute/AttributeState.as | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/LeafStyleBase.as b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/LeafStyleBase.as index 8f7fa8b173..8124c70ce5 100644 --- a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/LeafStyleBase.as +++ b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/LeafStyleBase.as @@ -191,7 +191,7 @@ package org.apache.royale.style.stylebeads } private function normalizeSelector(selector:String):String { // TODO this is pretty naive. We should probably be doing some kind of parsing here. - return "." + selector.replace(/:/g, "\\:").replace(/\./g, "\\.").replace(/\//g, "\\/"); + return "." + selector.replace(/(:|\.|\/)/g, "\\$1"); } public function getRule():String @@ -200,7 +200,7 @@ package org.apache.royale.style.stylebeads return ""; return ruleBase + ":" + calculatedRuleValue + ";"; } - private static const SPACE_DOT_REGEX:RegExp = /[\s\.]/g; + private static const SANITIZE_REGEX:RegExp = /[\s\.\(\)\+\*\/\[\]]/g; private static const PERCENT_REGEX:RegExp = /%/g; protected function sanitizeSelector(value:String):String { @@ -211,7 +211,9 @@ package org.apache.royale.style.stylebeads if(value.indexOf("%") >= 0) value = value.replace(PERCENT_REGEX, "p"); - return value.replace(SPACE_DOT_REGEX, "-"); + var sanitized:String = value.replace(SANITIZE_REGEX, "-"); + // Replace multiple consecutive dashes with a single dash + return sanitized.replace(/-+/g, "-"); } protected function acceptVar(value:String):String { diff --git a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/states/attribute/AttributeState.as b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/states/attribute/AttributeState.as index b9fea0de3d..3ebe3d88ac 100644 --- a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/states/attribute/AttributeState.as +++ b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/states/attribute/AttributeState.as @@ -23,6 +23,10 @@ package org.apache.royale.style.stylebeads.states.attribute public class AttributeState extends LeafDecorator { + override public function get isGroup():Boolean + { + return true; + } public function AttributeState(attribute:String = null, styles:Array = null) { super(styles);
