Fix #4114 - "black" being ignored as a color in some contexts.
authorSteve Bennett <stevagewp@gmail.com>
Sun, 4 Mar 2012 00:44:30 +0000 (11:44 +1100)
committerSteve Bennett <stevagewp@gmail.com>
Sun, 4 Mar 2012 00:44:30 +0000 (11:44 +1100)
Note: this kind of code can be a bug:
if (CSSCOLORS[colorstr]) {  }

do this instead:
if (CSSCOLORS[colorstr] != undefined) {  }

net/systemeD/halcyon/styleparser/RuleSet.as
net/systemeD/halcyon/styleparser/Style.as

index 9c0e37e..d26d68e 100644 (file)
@@ -531,7 +531,7 @@ package net.systemeD.halcyon.styleparser {
 
         public static function parseCSSColor(colorStr:String):uint {
             colorStr = colorStr.toLowerCase();
-            if (CSSCOLORS[colorStr]) {
+            if (CSSCOLORS[colorStr] != undefined) {
                 return CSSCOLORS[colorStr];
             } else {
                 var match:Object = HEX.exec(colorStr);
index 32285a8..a28ece1 100644 (file)
@@ -56,7 +56,7 @@ package net.systemeD.halcyon.styleparser {
                public function mergeWith(additional:Style):void {
                        for each (var prop:String in properties) {
                                // Note extra check for empty arrays, which we use to mean 'undefined' (see setPropertyFromString below)
-                               if (additional[prop] && !((additional[prop] is Array) && additional[prop].length==0)) {
+                               if (additional[prop] != undefined && !((additional[prop] is Array) && additional[prop].length==0)) {
                                        this[prop]=additional[prop];
                                }
                        }