This is an automated email from the ASF dual-hosted git repository.
carlosrovira pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new 887b696 Support for classList contains
887b696 is described below
commit 887b6967efb7159b816038d9d04589e782498fd4
Author: Carlos Rovira <[email protected]>
AuthorDate: Wed Jul 4 01:29:46 2018 +0200
Support for classList contains
---
.../apache/royale/core/StyledMXMLItemRenderer.as | 62 +++++++++++++++------
.../royale/org/apache/royale/core/StyledUIBase.as | 61 ++++++++++++++++-----
.../org/apache/royale/utils/ClassSelectorList.as | 52 ++++++++++++++++--
.../royale/utils/IClassSelectorListSupport.as | 49 ++++++++++++-----
.../royale/org/apache/royale/jewel/Container.as | 63 ++++++++++++++++------
.../main/royale/org/apache/royale/jewel/Group.as | 61 ++++++++++++++++-----
6 files changed, 274 insertions(+), 74 deletions(-)
diff --git
a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/StyledMXMLItemRenderer.as
b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/StyledMXMLItemRenderer.as
index 216cc97..73440f1 100644
---
a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/StyledMXMLItemRenderer.as
+++
b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/StyledMXMLItemRenderer.as
@@ -56,12 +56,14 @@ package org.apache.royale.core
}
/**
- * adds a class name
+ * Add a class selector to the list.
*
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion Royale 0.9.3
+ * @param name Name of selector to add.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.3
*/
public function addClass(name:String):void
{
@@ -72,13 +74,18 @@ package org.apache.royale.core
}
/**
- * removes a class name
+ * Removes a class selector from the list.
*
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion Royale 0.9.3
- */
+ * @param name Name of selector to remove.
+ *
+ * @royaleignorecoercion HTMLElement
+ * @royaleignorecoercion DOMTokenList
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.3
+ */
public function removeClass(name:String):void
{
COMPILE::JS
@@ -88,20 +95,45 @@ package org.apache.royale.core
}
/**
- * toggle a class name
+ * Add or remove a class selector to/from the list.
+ *
+ * @param name Name of selector to add or remove.
+ * @param value True to add, False to remove.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.3
+ */
+ public function toggleClass(name:String, value:Boolean):void
+ {
+ COMPILE::JS
+ {
+ classSelectorList.toggle(name, value);
+ }
+ }
+
+ /**
+ * Search for the name in the element class list
*
+ * @param name Name of selector to find.
+ * @return return true if the name is found or false otherwise.
+ *
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.9.3
*/
- public function toggleClass(name:String, value:Boolean):void
+ public function containsClass(name:String):Boolean
{
COMPILE::JS
{
- classSelectorList.toggle(name, value);
+ return classSelectorList.contains(name);
+ }
+ COMPILE::SWF
+ {//not implemented
+ return false;
}
}
-
}
}
diff --git
a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/StyledUIBase.as
b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/StyledUIBase.as
index c8f85d0..3f90a94 100644
---
a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/StyledUIBase.as
+++
b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/StyledUIBase.as
@@ -75,12 +75,14 @@ package org.apache.royale.core
}
/**
- * adds a class name
+ * Add a class selector to the list.
*
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion Royale 0.9.3
+ * @param name Name of selector to add.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.3
*/
public function addClass(name:String):void
{
@@ -91,13 +93,18 @@ package org.apache.royale.core
}
/**
- * removes a class name
+ * Removes a class selector from the list.
*
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion Royale 0.9.3
- */
+ * @param name Name of selector to remove.
+ *
+ * @royaleignorecoercion HTMLElement
+ * @royaleignorecoercion DOMTokenList
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.3
+ */
public function removeClass(name:String):void
{
COMPILE::JS
@@ -107,18 +114,44 @@ package org.apache.royale.core
}
/**
- * toggle a class name
+ * Add or remove a class selector to/from the list.
+ *
+ * @param name Name of selector to add or remove.
+ * @param value True to add, False to remove.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.3
+ */
+ public function toggleClass(name:String, value:Boolean):void
+ {
+ COMPILE::JS
+ {
+ classSelectorList.toggle(name, value);
+ }
+ }
+
+ /**
+ * Search for the name in the element class list
*
+ * @param name Name of selector to find.
+ * @return return true if the name is found or false otherwise.
+ *
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.9.3
*/
- public function toggleClass(name:String, value:Boolean):void
+ public function containsClass(name:String):Boolean
{
COMPILE::JS
{
- classSelectorList.toggle(name, value);
+ return classSelectorList.contains(name);
+ }
+ COMPILE::SWF
+ {//not implemented
+ return false;
}
}
}
diff --git
a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/ClassSelectorList.as
b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/ClassSelectorList.as
index aa85f3c..edbe151 100644
---
a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/ClassSelectorList.as
+++
b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/ClassSelectorList.as
@@ -26,8 +26,7 @@ package org.apache.royale.utils
*
* @langversion 3.0
* @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Royale 1.0.0
+ * @playerversion AIR 2.6
* @productversion Royale 0.9.3
*/
public class ClassSelectorList
@@ -44,7 +43,13 @@ package org.apache.royale.utils
/**
* Add a class selector to the list.
+ *
* @param name Name of selector to add.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.3
*/
public function add(name:String):void
{
@@ -57,11 +62,17 @@ package org.apache.royale.utils
}
/**
- * Add a class selector to the list.
+ * Removes a class selector from the list.
+ *
* @param name Name of selector to remove.
*
* @royaleignorecoercion HTMLElement
* @royaleignorecoercion DOMTokenList
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.3
*/
public function remove(name:String):void
{
@@ -80,8 +91,14 @@ package org.apache.royale.utils
/**
* Add or remove a class selector to/from the list.
+ *
* @param name Name of selector to add or remove.
* @param value True to add, False to remove.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.3
*/
public function toggle(name:String, value:Boolean):void
{
@@ -92,13 +109,42 @@ package org.apache.royale.utils
startIndex++;
}
}
+
+ /**
+ * Search for the name in the element class list
+ *
+ * @param name Name of selector to find.
+ * @return return true if the name is found or false otherwise.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.3
+ */
+ public function contains(name:String):Boolean
+ {
+ COMPILE::JS
+ {
+ return component.positioner.classList.contains(name);
+ }
+ COMPILE::SWF
+ {//not implemented
+ return false;
+ }
+ }
/**
* Add a space-separated list of names.
* @param names Space-separated list of names to add.
+ *
* @royaleignorecoercion HTMLElement
* @royaleignorecoercion DOMTokenList
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.3
*/
public function addNames(names:String):void
{
diff --git
a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/IClassSelectorListSupport.as
b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/IClassSelectorListSupport.as
index b131984..0edba78 100644
---
a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/IClassSelectorListSupport.as
+++
b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/IClassSelectorListSupport.as
@@ -30,33 +30,56 @@ package org.apache.royale.utils
public interface IClassSelectorListSupport
{
/**
- * adds a class name
+ * Add a class selector to the list.
*
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion Royale 0.9.3
+ * @param name Name of selector to add.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.3
*/
function addClass(name:String):void
/**
- * removes a class name
+ * Removes a class selector from the list.
*
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion Royale 0.9.3
- */
+ * @param name Name of selector to remove.
+ *
+ * @royaleignorecoercion HTMLElement
+ * @royaleignorecoercion DOMTokenList
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.3
+ */
function removeClass(name:String):void
/**
- * toggle a class name
+ * Add or remove a class selector to/from the list.
+ *
+ * @param name Name of selector to add or remove.
+ * @param value True to add, False to remove.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.3
+ */
+ function toggleClass(name:String, value:Boolean):void
+
+ /**
+ * Search for the name in the element class list
*
+ * @param name Name of selector to find.
+ * @return return true if the name is found or false otherwise.
+ *
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.9.3
*/
- function toggleClass(name:String, value:Boolean):void
+ function containsClass(name:String):Boolean
}
}
diff --git
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Container.as
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Container.as
index d296f3f..3d2f347 100644
---
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Container.as
+++
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Container.as
@@ -95,12 +95,14 @@ package org.apache.royale.jewel
}
/**
- * adds a class name
+ * Add a class selector to the list.
*
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion Royale 0.9.3
+ * @param name Name of selector to add.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.3
*/
public function addClass(name:String):void
{
@@ -111,13 +113,18 @@ package org.apache.royale.jewel
}
/**
- * removes a class name
+ * Removes a class selector from the list.
*
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion Royale 0.9.3
- */
+ * @param name Name of selector to remove.
+ *
+ * @royaleignorecoercion HTMLElement
+ * @royaleignorecoercion DOMTokenList
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.3
+ */
public function removeClass(name:String):void
{
COMPILE::JS
@@ -127,21 +134,47 @@ package org.apache.royale.jewel
}
/**
- * toggle a class name
+ * Add or remove a class selector to/from the list.
+ *
+ * @param name Name of selector to add or remove.
+ * @param value True to add, False to remove.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.3
+ */
+ public function toggleClass(name:String, value:Boolean):void
+ {
+ COMPILE::JS
+ {
+ classSelectorList.toggle(name, value);
+ }
+ }
+
+ /**
+ * Search for the name in the element class list
*
+ * @param name Name of selector to find.
+ * @return return true if the name is found or false otherwise.
+ *
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.9.3
*/
- public function toggleClass(name:String, value:Boolean):void
+ public function containsClass(name:String):Boolean
{
+ COMPILE::SWF
+ {//not implemented
+ return false;
+ }
COMPILE::JS
{
- classSelectorList.toggle(name, value);
+ return classSelectorList.contains(name);
}
}
-
+
private var _mxmlDescriptor:Array;
private var _mxmlDocument:Object = this;
private var _initialized:Boolean;
diff --git
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Group.as
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Group.as
index edf58b9..fa51adf 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Group.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Group.as
@@ -61,12 +61,14 @@ package org.apache.royale.jewel
}
/**
- * adds a class name
+ * Add a class selector to the list.
*
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion Royale 0.9.3
+ * @param name Name of selector to add.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.3
*/
public function addClass(name:String):void
{
@@ -77,13 +79,18 @@ package org.apache.royale.jewel
}
/**
- * removes a class name
+ * Removes a class selector from the list.
*
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion Royale 0.9.3
- */
+ * @param name Name of selector to remove.
+ *
+ * @royaleignorecoercion HTMLElement
+ * @royaleignorecoercion DOMTokenList
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.3
+ */
public function removeClass(name:String):void
{
COMPILE::JS
@@ -93,18 +100,44 @@ package org.apache.royale.jewel
}
/**
- * toggle a class name
+ * Add or remove a class selector to/from the list.
+ *
+ * @param name Name of selector to add or remove.
+ * @param value True to add, False to remove.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.3
+ */
+ public function toggleClass(name:String, value:Boolean):void
+ {
+ COMPILE::JS
+ {
+ classSelectorList.toggle(name, value);
+ }
+ }
+
+ /**
+ * Search for the name in the element class list
*
+ * @param name Name of selector to find.
+ * @return return true if the name is found or false otherwise.
+ *
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.9.3
*/
- public function toggleClass(name:String, value:Boolean):void
+ public function containsClass(name:String):Boolean
{
+ COMPILE::SWF
+ {//not implemented
+ return false;
+ }
COMPILE::JS
{
- classSelectorList.toggle(name, value);
+ return classSelectorList.contains(name);
}
}
}