flex-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Harbs (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLEX-35070) "for each" not working in XMLList
Date Tue, 12 Apr 2016 19:32:25 GMT

    [ https://issues.apache.org/jira/browse/FLEX-35070?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15237820#comment-15237820
] 

Harbs commented on FLEX-35070:
------------------------------

Interesting. I was working from memory, and I thought length was iterable. It's not.

However, my point is still valid when it comes to polyfills.

For example: (ignore the exact code in the polyfill. there could be better code)
Array.prototype.filter = function(a,b,c,d,e) {
      c = this; // cache the array
      d = []; // array to hold the new values which match the expression
      for (e in c) // for each value in the array, 
        ~~e + '' == e && e >= 0 && // coerce the array position and if
valid,
        a.call(b, c[e], +e, c) && // pass the current value into the expression and
if truthy,
        d.push(c[e]); // add it to the new array
      return d // give back the new array
  }
var arr = ["hi"];
var x;
for(x in arr){
Console.log(x)
}
will give you:
0
filter

> "for each" not working in XMLList
> ---------------------------------
>
>                 Key: FLEX-35070
>                 URL: https://issues.apache.org/jira/browse/FLEX-35070
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: FalconJX
>    Affects Versions: Apache FalconJX 0.6.0
>            Reporter: Harbs
>
> I don't have a full test case right now, but I believe the following will fail.
> var newList:XMLList = new XMLList();
> newList.appendChild(<foo/>);
> var xmlItem:XML;
> for each(xmlItem in oldList)
>   newList.appendChild(xmlItem);
> If necessary, I can put together a (non)working test case.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message