[
https://issues.apache.org/jira/browse/FLEX-35070?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15235473#comment-15235473
]
Harbs commented on FLEX-35070:
------------------------------
I started writing a whole suggestion here, but I'm wondering if the current
approach is correct at all.
"for each" in ActionScript is for array-type objects.
"for in" in Javascript is not the greatest alternate for that. It's pretty
common to abuse the Array prototype to add polyfills for older browsers. That
would result in for in iterating over that. In fact, for in will always iterate
over "length".
Why not compile "for each" into a "for" or "while" loop instead? for eahc is
not much more that syntactic sugar.
AFA XML types go, the length could be:
var len = isNaN(foreachiter0_target.length) ? foreachiter0_target.length() :
foreachiter0_target.length;
> "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)