parse off units and do conversions

Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/aa8c5901
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/aa8c5901
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/aa8c5901

Branch: refs/heads/develop
Commit: aa8c5901267c96816332a26ffb1d14fe76b3c434
Parents: 2436e99
Author: Alex Harui <[email protected]>
Authored: Fri Jan 9 07:45:46 2015 -0800
Committer: Alex Harui <[email protected]>
Committed: Fri Jan 9 08:09:49 2015 -0800

----------------------------------------------------------------------
 .../org/apache/flex/core/SimpleCSSValuesImpl.as    | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/aa8c5901/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleCSSValuesImpl.as
----------------------------------------------------------------------
diff --git 
a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleCSSValuesImpl.as
 
b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleCSSValuesImpl.as
index 263d3a2..04855f1 100644
--- 
a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleCSSValuesImpl.as
+++ 
b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleCSSValuesImpl.as
@@ -504,7 +504,22 @@ package org.apache.flex.core
                 {
                     var n:Number = Number(value);
                     if (isNaN(n))
-                        obj[pieces[0]] = value;
+                    {
+                        if (value.charAt(0) == "#")
+                        {
+                            value = value.replace("#", "0x");
+                            n = parseInt(value);
+                            obj[pieces[0]] = n;
+                        }
+                        else
+                        {
+                            if (value.charAt(0) == "'")
+                                value = value.substr(1, value.length - 2);
+                            else if (value.charAt(0) == '"')
+                                value = value.substr(1, value.length - 2);
+                            obj[pieces[0]] = value;
+                        }
+                    }
                     else
                         obj[pieces[0]] = n;
                 }

Reply via email to