Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array - sortOn fails for XML data #1203

Open
yishayw opened this issue Jun 13, 2022 · 1 comment
Open

Array - sortOn fails for XML data #1203

yishayw opened this issue Jun 13, 2022 · 1 comment

Comments

@yishayw
Copy link
Contributor

yishayw commented Jun 13, 2022

In this app

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                applicationComplete="init()"
                width="100%"
                height="100%"
                xmlns:s="library://ns.apache.org/royale/spark"
                xmlns:mx="library://ns.apache.org/royale/mx">
                
     <fx:Script>
        <![CDATA[
            import mx.managers.PopUpManager;
            private function init():void
            {
                var arr:Array = [<node label="b"/>, <node label="a"/>];
                arr.sortOn(["@label"]);
                trace(((arr[0] as XML).@label).toString());
            }
        ]]>
    </fx:Script>
</mx:Application>

I would expect the trace output to be 'a' (as it is in Flex), but instead it is 'b'.

Apparently flash player knows how to parse XML and can sort an array of XML objects, but Language.as does assumes the objects are simple and does not read @label correctly.

As, in Royale, XML is a separate library the question is whether Language.as where this sortOn function is location, is, or even should be, made aware of XML objects.

@estanglerbm
Copy link
Contributor

#1150

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants