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

piotrz 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 4340b40  ClassSelectorList: Fix issue with infinite loop in addNames 
function
4340b40 is described below

commit 4340b40997cf2f445f0a228559146ba88f073c24
Author: Piotr Zarzycki <[email protected]>
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
[email protected].

Reply via email to