You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2018/03/13 15:21:48 UTC
[royale-asjs] branch feature/uibase-classlist updated: update
classList to fix issues. Now work totaly as expected
This is an automated email from the ASF dual-hosted git repository.
carlosrovira pushed a commit to branch feature/uibase-classlist
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/feature/uibase-classlist by this push:
new 2f62968 update classList to fix issues. Now work totaly as expected
2f62968 is described below
commit 2f6296813d63ecd39857b5d5c65398cf01957ef7
Author: Carlos Rovira <ca...@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
carlosrovira@apache.org.