This is an automated email from the ASF dual-hosted git repository.

carlosrovira pushed a commit to branch feature/jewel-ui-set
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit 238a5811bc53bb744ed5d1745a0765ef964e8eb9
Author: Carlos Rovira <carlosrov...@apache.org>
AuthorDate: Tue Mar 13 16:21:45 2018 +0100

    update classList to fix issues. Now work totaly as expected
---
 .../main/royale/org/apache/royale/core/UIBase.as   | 38 ++++++++++++++++++++--
 .../main/royale/org/apache/royale/jewel/Button.as  |  5 ++-
 .../royale/org/apache/royale/jewel/TextButton.as   |  4 +--
 3 files changed, 38 insertions(+), 9 deletions(-)

diff --git 
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/core/UIBase.as 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/core/UIBase.as
index 7abe638..2d279c0 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/core/UIBase.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/core/UIBase.as
@@ -1025,8 +1025,39 @@ package org.apache.royale.core
          * 
          *  @royalesuppresspublicvarwarning
          */
-        public var typeNames:String;
+        private var _typeNames:String;
         
+        /**
+         *  The classname.  Often used for CSS
+         *  class selector lookups.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.0
+         */
+        public function get typeNames():String
+               {
+                       return _typeNames;
+               }
+
+        /**
+         *  @private
+         */
+        public function set typeNames(value:String):void
+        {
+            if (_typeNames !== value)
+            {
+                _typeNames = value;
+
+                COMPILE::JS
+                {
+                    element.className = "";
+                    setClassName(_typeNames);             
+                }
+            }
+        }
+
         private var _className:String;
 
         /**
@@ -1054,7 +1085,7 @@ package org.apache.royale.core
 
                 COMPILE::JS
                 {
-                    setClassName(_className);             
+                    setClassName(typeNames ? typeNames + " " + _className : 
_className);             
                 }
                 
                 dispatchEvent(new Event("classNameChanged"));
@@ -1064,7 +1095,8 @@ package org.apache.royale.core
         COMPILE::JS
         protected function setClassName(value:String):void
         {
-            element.classList.add(value);
+            var classes:Array = value.split(" ");
+            element.classList.add.apply(element.classList, classes);
         }
 
         /**
diff --git 
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Button.as 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Button.as
index 224c789..53f58e4 100644
--- 
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Button.as
+++ 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Button.as
@@ -59,9 +59,8 @@ package org.apache.royale.jewel
                {
                        super();
 
-            COMPILE::JS {
-                element.classList.add("jewel", "button");
-            }
+            
+            typeNames = "jewel button";
                }
 
         private var _primary:Boolean = false;
diff --git 
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/TextButton.as
 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/TextButton.as
index 23eb625..67fdcdd 100644
--- 
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/TextButton.as
+++ 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/TextButton.as
@@ -51,9 +51,7 @@ package org.apache.royale.jewel
                {
                        super();
 
-            COMPILE::JS {
-                element.classList.add("jewel", "textbutton");
-            }
+            typeNames = "jewel textbutton";
                }
         
         /**

-- 
To stop receiving notification emails like this one, please contact
carlosrov...@apache.org.

Reply via email to