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

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


The following commit(s) were added to refs/heads/jewel-ui by this push:
     new 6ca450e  remove CSSClassList in favor of element.classList, but this 
could be improved to be more simple doing some changes in UIBase
6ca450e is described below

commit 6ca450e1949bf46e8445ffacf18d375eda2ec261
Author: Carlos Rovira <carlosrov...@apache.org>
AuthorDate: Mon Mar 12 16:39:25 2018 +0100

    remove CSSClassList in favor of element.classList, but this could be 
improved to be more simple doing some changes in UIBase
---
 .../src/main/royale/ButtonPlayGround.mxml          |  3 ++
 .../main/royale/org/apache/royale/jewel/Button.as  | 37 +++-------------------
 .../royale/org/apache/royale/jewel/TextButton.as   | 13 --------
 3 files changed, 8 insertions(+), 45 deletions(-)

diff --git a/examples/royale/JewelExample/src/main/royale/ButtonPlayGround.mxml 
b/examples/royale/JewelExample/src/main/royale/ButtonPlayGround.mxml
index f217fca..5ca13a1 100644
--- a/examples/royale/JewelExample/src/main/royale/ButtonPlayGround.mxml
+++ b/examples/royale/JewelExample/src/main/royale/ButtonPlayGround.mxml
@@ -31,6 +31,9 @@ limitations under the License.
        ]]>
        </fx:Script>
 
+       <js:beads>
+               <js:VerticalLayoutWithPaddingAndGap gap="10"/>
+       </js:beads>
        
        <js:Label text="Basic"/>
        <js:Button/>
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 1dadb55..70d4d58 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
@@ -24,7 +24,6 @@ package org.apache.royale.jewel
     {
         import org.apache.royale.core.WrappedHTMLElement;
         import org.apache.royale.html.util.addElementToWrapper;
-        import org.apache.royale.core.CSSClassList;
     }
 
     /**
@@ -61,39 +60,12 @@ package org.apache.royale.jewel
                        super();
 
             typeNames = "jewel button";
-
-            COMPILE::JS
-            {
-                _classList = new CSSClassList();
-            }
                }
 
         COMPILE::JS
-        protected var _classList:CSSClassList;
-
-        /**
-                * @private
-                * @royaleignorecoercion 
org.apache.royale.core.WrappedHTMLElement
-                */
-               /*COMPILE::JS
-               override protected function createElement():WrappedHTMLElement
-               {
-                       addElementToWrapper(this,'button');
-            element.setAttribute('type', 'button');
-                       typeNames = "jewel button";
-                       return element;
-               }*/
-
-        COMPILE::JS
-        protected function addOrRemove(classNameVal:String,add:Boolean):void
-        {
-            add ? _classList.add(classNameVal) : 
_classList.remove(classNameVal);
-        }
-
-        COMPILE::JS
         override protected function computeFinalClassNames():String
         {
-            return super.computeFinalClassNames() + " " + _classList.compute();
+            return super.computeFinalClassNames() + " " + element.classList;
         }
 
         private var _primary:Boolean = false;
@@ -121,7 +93,8 @@ package org.apache.royale.jewel
 
                 COMPILE::JS
                 {
-                    addOrRemove("primary",value);
+                    
+                    element.classList.toggle("primary", value);
                     setClassName(computeFinalClassNames());
                 }
             }
@@ -152,7 +125,7 @@ package org.apache.royale.jewel
 
                 COMPILE::JS
                 {
-                    addOrRemove("secondary",value);
+                    element.classList.toggle("secondary", value);
                     setClassName(computeFinalClassNames());
                 }
             }
@@ -183,7 +156,7 @@ package org.apache.royale.jewel
 
                 COMPILE::JS
                 {
-                    addOrRemove("emphasized",value);
+                    element.classList.toggle("emphasized", value);
                     setClassName(computeFinalClassNames());
                 }
             }
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 b02e5fe..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
@@ -125,18 +125,5 @@ package org.apache.royale.jewel
                 this.dispatchEvent('textChange');
             }
                }
-        
-        /**
-                * @private
-                * @royaleignorecoercion 
org.apache.royale.core.WrappedHTMLElement
-                */
-               /*COMPILE::JS
-               override protected function createElement():WrappedHTMLElement
-               {
-                       addElementToWrapper(this,'button');
-            element.setAttribute('type', 'button');
-                       typeNames = "jewel textbutton";
-                       return element;
-        }*/
        }
 }

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

Reply via email to