Re: ClassSelectorList

2020-02-02 Thread Carlos Rovira
Hi Harbs,

no. when we initially made this feature it was for element, but if you
check most of the Jewel controls and containers redefine positioner since
to have more html structure to make it possible to style them
appropriately. So usually you want to use style positioner and use CSS to
target inner elements (event "element" itself) through cascading

Check Jewel for plenty of example that combine createElement + positioner
in *.as classes plus corresponding .sass file.

El dom., 2 feb. 2020 a las 22:12, Harbs () escribió:

> Why does ClassSelectorList use positioner instead of element? I would
> think that the class names should be applied to the element rather than the
> positioner.



-- 
Carlos Rovira
http://about.me/carlosrovira


ClassSelectorList

2020-02-02 Thread Harbs
Why does ClassSelectorList use positioner instead of element? I would think 
that the class names should be applied to the element rather than the 
positioner.

Re: [royale-asjs] branch develop updated: ClassSelectorList: Fix issue with infinite loop in addNames function

2018-04-30 Thread Alex Harui
Ah ok.  I was reading the diff incorrectly.

Sorry for the confusion.
-Alex

On 4/29/18, 11:57 PM, "Piotr Zarzycki" <piotrzarzyck...@gmail.com> wrote:

Alex,

I'm not sure what do you mean. I have added here that line:

count = classList.length - startIndex;

Without it I'm having infinite loop when I use  ClassSelectorList in MDL
NavigationLayout.

Piotr

2018-04-30 2:06 GMT+02:00 Alex Harui <aha...@adobe.com.invalid>:

> Hi Piotr,
>
> Are you sure it is right to remove names that were there before?
>
> -Alex
>
> On 4/29/18, 10:48 AM, "pio...@apache.org" <pio...@apache.org> wrote:
>
> This is an automated email from the ASF dual-hosted git repository.
>
> piotrz pushed a commit to branch develop
> in repository https://na01.safelinks.protection.outlook.com/?url=
> https%3A%2F%2Fgitbox.apache.org%2Frepos%2Fasf%2Froyale-
> asjs.git=02%7C01%7Caharui%40adobe.com%7C0fc0bb013c6b498d00cd08d5adf9
> 6581%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%
> 7C636606209043570512=1%2FgKb08tPhVJAbGu7lsE1vpep6pjlN
> wME6i5zHxf65M%3D=0
>
>
> The following commit(s) were added to refs/heads/develop by this push:
>  new 4340b40  ClassSelectorList: Fix issue with infinite loop in
> addNames function
> 4340b40 is described below
>
> commit 4340b40997cf2f445f0a228559146ba88f073c24
> Author: Piotr Zarzycki <piotrzarzyck...@gmail.com>
> AuthorDate: Sun Apr 29 19:48:09 2018 +0200
>
> ClassSelectorList: Fix issue with infinite loop in addNames
> function
> ---
>  .../org/apache/royale/utils/ClassSelectorList.as   | 38
> ++
>  1 file changed, 24 insertions(+), 14 deletions(-)
>
> 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 6c35dc3..79c1b34 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
> @@ -59,6 +59,9 @@ package org.apache.royale.utils
>  /**
>   * Add a class selector to the list.
>   * @param name Name of selector to remove.
> + *
> + * @royaleignorecoercion HTMLElement
> + * @royaleignorecoercion DOMTokenList
>   */
>  public function remove(name:String):void
>  {
> @@ -95,27 +98,34 @@ package org.apache.royale.utils
>   * Add a space-separated list of names.
>   * @param names Space-separated list of names to add.
>   * @royaleignorecoercion HTMLElement
> + * @royaleignorecoercion DOMTokenList
>   */
>  public function addNames(names:String):void
>  {
>  COMPILE::JS
>  {
> -var positioner:HTMLElement = component.positioner as
> HTMLElement;
> -var classList:DOMTokenList = positioner.classList;
> -if (component.parent)
> -{
> -// remove names that were set last time
> -while (count > 0)
> +var positioner:HTMLElement = component.positioner as
> HTMLElement;
> +var classList:DOMTokenList = positioner.classList;
> +if (component.parent)
>  {
> -var name:String = classList.item(startIndex);
> -classList.remove(name);
> +// remove names that were set last time
> +while (count > 0)
> +{
> +var name:String = classList.item(startIndex);
> +classList.remove(name);
> +count = classList.length - startIndex;
> +}
>  }
> -}
> -if (startIndex > 0)
> -positioner.className += " " + names;
> -else
> -positioner.className = names;
> -count = 

Re: [royale-asjs] branch develop updated: ClassSelectorList: Fix issue with infinite loop in addNames function

2018-04-30 Thread Piotr Zarzycki
Alex,

I'm not sure what do you mean. I have added here that line:

count = classList.length - startIndex;

Without it I'm having infinite loop when I use  ClassSelectorList in MDL
NavigationLayout.

Piotr

2018-04-30 2:06 GMT+02:00 Alex Harui <aha...@adobe.com.invalid>:

> Hi Piotr,
>
> Are you sure it is right to remove names that were there before?
>
> -Alex
>
> On 4/29/18, 10:48 AM, "pio...@apache.org" <pio...@apache.org> wrote:
>
> This is an automated email from the ASF dual-hosted git repository.
>
> piotrz pushed a commit to branch develop
> in repository https://na01.safelinks.protection.outlook.com/?url=
> https%3A%2F%2Fgitbox.apache.org%2Frepos%2Fasf%2Froyale-
> asjs.git=02%7C01%7Caharui%40adobe.com%7C0fc0bb013c6b498d00cd08d5adf9
> 6581%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%
> 7C636606209043570512=1%2FgKb08tPhVJAbGu7lsE1vpep6pjlN
> wME6i5zHxf65M%3D=0
>
>
> The following commit(s) were added to refs/heads/develop by this push:
>  new 4340b40  ClassSelectorList: Fix issue with infinite loop in
> addNames function
> 4340b40 is described below
>
> commit 4340b40997cf2f445f0a228559146ba88f073c24
> Author: Piotr Zarzycki <piotrzarzyck...@gmail.com>
> AuthorDate: Sun Apr 29 19:48:09 2018 +0200
>
> ClassSelectorList: Fix issue with infinite loop in addNames
> function
> ---
>  .../org/apache/royale/utils/ClassSelectorList.as   | 38
> ++
>  1 file changed, 24 insertions(+), 14 deletions(-)
>
> 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 6c35dc3..79c1b34 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
> @@ -59,6 +59,9 @@ package org.apache.royale.utils
>  /**
>   * Add a class selector to the list.
>   * @param name Name of selector to remove.
> + *
> + * @royaleignorecoercion HTMLElement
> + * @royaleignorecoercion DOMTokenList
>   */
>  public function remove(name:String):void
>  {
> @@ -95,27 +98,34 @@ package org.apache.royale.utils
>   * Add a space-separated list of names.
>   * @param names Space-separated list of names to add.
>   * @royaleignorecoercion HTMLElement
> + * @royaleignorecoercion DOMTokenList
>   */
>  public function addNames(names:String):void
>  {
>  COMPILE::JS
>  {
> -var positioner:HTMLElement = component.positioner as
> HTMLElement;
> -var classList:DOMTokenList = positioner.classList;
> -if (component.parent)
> -{
> -// remove names that were set last time
> -while (count > 0)
> +var positioner:HTMLElement = component.positioner as
> HTMLElement;
> +var classList:DOMTokenList = positioner.classList;
> +if (component.parent)
>  {
> -var name:String = classList.item(startIndex);
> -classList.remove(name);
> +// remove names that were set last time
> +while (count > 0)
> +{
> +var name:String = classList.item(startIndex);
> +classList.remove(name);
> +count = classList.length - startIndex;
> +}
>  }
> -}
> -if (startIndex > 0)
> -positioner.className += " " + names;
> -else
> -positioner.className = names;
> -count = classList.length - startIndex;
> +
> +if (startIndex > 0)
> +{
> +positioner.className += " " + names;
> +}
> +else
> +{
> +positioner.className = names;
> +}
> +count = classList.length - startIndex;
>  }
>  }
>  }
>
> --
> To stop receiving notification emails like this one, please contact
> pio...@apache.org.
>
>
>


-- 

Piotr Zarzycki

Patreon: *https://www.patreon.com/piotrzarzycki
<https://www.patreon.com/piotrzarzycki>*


Re: [royale-asjs] branch develop updated: ClassSelectorList: Fix issue with infinite loop in addNames function

2018-04-29 Thread Alex Harui
Hi Piotr,

Are you sure it is right to remove names that were there before?

-Alex

On 4/29/18, 10:48 AM, "pio...@apache.org" <pio...@apache.org> wrote:

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

piotrz pushed a commit to branch develop
in repository 
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitbox.apache.org%2Frepos%2Fasf%2Froyale-asjs.git=02%7C01%7Caharui%40adobe.com%7C0fc0bb013c6b498d00cd08d5adf96581%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636606209043570512=1%2FgKb08tPhVJAbGu7lsE1vpep6pjlNwME6i5zHxf65M%3D=0


The following commit(s) were added to refs/heads/develop by this push:
     new 4340b40  ClassSelectorList: Fix issue with infinite loop in 
addNames function
4340b40 is described below

commit 4340b40997cf2f445f0a228559146ba88f073c24
Author: Piotr Zarzycki <piotrzarzyck...@gmail.com>
AuthorDate: Sun Apr 29 19:48:09 2018 +0200

    ClassSelectorList: Fix issue with infinite loop in addNames function
---
 .../org/apache/royale/utils/ClassSelectorList.as   | 38 
++
 1 file changed, 24 insertions(+), 14 deletions(-)

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 6c35dc3..79c1b34 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
@@ -59,6 +59,9 @@ package org.apache.royale.utils
 /**
  * Add a class selector to the list.
  * @param name Name of selector to remove.
+ *
+ * @royaleignorecoercion HTMLElement
+ * @royaleignorecoercion DOMTokenList
  */
 public function remove(name:String):void
 {
@@ -95,27 +98,34 @@ package org.apache.royale.utils
  * Add a space-separated list of names.
  * @param names Space-separated list of names to add.
  * @royaleignorecoercion HTMLElement
+ * @royaleignorecoercion DOMTokenList
  */
 public function addNames(names:String):void
 {
 COMPILE::JS
 {
-var positioner:HTMLElement = component.positioner as 
HTMLElement;
-var classList:DOMTokenList = positioner.classList;
-if (component.parent)
-{
-// remove names that were set last time
-while (count > 0)
+var positioner:HTMLElement = component.positioner as 
HTMLElement;
+var classList:DOMTokenList = positioner.classList;
+if (component.parent)
 {
-var name:String = classList.item(startIndex);
-classList.remove(name);
+// remove names that were set last time
+while (count > 0)
+{
+var name:String = classList.item(startIndex);
+classList.remove(name);
+count = classList.length - startIndex;
+}
 }
-}
-if (startIndex > 0)
-positioner.className += " " + names;
-else
-positioner.className = names;
-count = classList.length - startIndex;
+
+if (startIndex > 0)
+{
+positioner.className += " " + names;
+}
+else
+{
+positioner.className = names;
+}
+count = classList.length - startIndex;
 }
 }
 }

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