This is an automated email from the ASF dual-hosted git repository. joshtynjala pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
commit ca46a4fe36d03ea81f9d3111527af1962c51bbf3 Author: Josh Tynjala <[email protected]> AuthorDate: Mon Oct 6 15:10:55 2025 -0700 JSCSSCompilationSession: improved distinction between components and HTML elements when outputting CSS Followup to commit 3f09ebc41206a2578745e14ba6d705b7c4b3b6a2, which could incorrectly treat components in the default namespace as HTML elements. Now checks if the element name is in the known htmlElementNames list (which needs to be updated, actually), but also checks if the resolved qname contains a "." character, which would indicate an AS3/MXML class in a package, which is definitely not an HTML element. I added that extra check to avoid the possibility of a class name like Button possibly matching an element like <button>. I also removed the namespace prefix check I was using in that commit to allow the XHTML namespace to [...] --- .../internal/driver/js/royale/JSCSSCompilationSession.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/driver/js/royale/JSCSSCompilationSession.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/driver/js/royale/JSCSSCompilationSession.java index e98fb35e3..c94a112b2 100644 --- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/driver/js/royale/JSCSSCompilationSession.java +++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/driver/js/royale/JSCSSCompilationSession.java @@ -42,7 +42,10 @@ import com.google.common.collect.ImmutableList; public class JSCSSCompilationSession extends CSSCompilationSession { - private List<String> otherCSSFunctions = Arrays.asList( + private static final String GLOBAL_SELECTOR = "global"; + private static final String UNIVERSAL_SELECTOR = "*"; + + private List<String> otherCSSFunctions = Arrays.asList( "-moz-linear-gradient", "-webkit-linear-gradient", "linear-gradient", @@ -213,10 +216,10 @@ public class JSCSSCompilationSession extends CSSCompilationSession String elementName = selector.getElementName(); if (elementName != null) { - if (!"*".equals(elementName)) + if (!UNIVERSAL_SELECTOR.equals(elementName) && !GLOBAL_SELECTOR.equals(elementName)) { - String nsPrefix = selector.getNamespacePrefix(); - if (nsPrefix != null) + String qname = resolvedSelectors.get(selector); + if ((qname != null && qname.contains(".")) || !htmlElementNames.contains(elementName.toLowerCase())) { // add "." to type selectors that don't map cleanly // to CSS type selectors to convert them to class
