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&data=02%7C01%7Caharui%40adobe.com%7C0fc0bb013c6b498d00cd08d5adf96581%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636606209043570512&sdata=1%2FgKb08tPhVJAbGu7lsE1vpep6pjlNwME6i5zHxf65M%3D&reserved=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.