flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Harui <aha...@adobe.com>
Subject Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)
Date Mon, 08 Feb 2016 05:09:15 GMT

Is it possible you are being tricked by the difference between the XML
length() method and the Object length property?  The following outputs 1
for me:

var xml:XML = <node><child /></node>;

AFAICT, the spec is recommending an internal implementation that is not
quite a 1:1 mapping to the public API.  It suggests keeping an ordered
list of child nodes based upon how the Insert function got called so that
if there is a "get" with a numeric property name, there is a specific
behavior (conversion to XMLList and subsequent access of the correct
child).  It does not seem to specify that there are properties like [0],
[1], [2] on the XML object itself.  Rather, the get function is called
with a numeric property name.

I really hadn't looked at the spec in any great detail until tonight, but
it made me wonder if FalconJX should be outputting calls to insert,
replace, put, get, etc.  We would add some sort of prefix and/or suffix to
the internal methods so they don't really appear in the public API.


On 2/7/16, 9:38 AM, "Harbs" <harbs.lists@gmail.com> wrote:

>Yeah. Except an XML object always has a length of 0… AFAIK, xmlObj[1]
>always returns undefined. The only valid index on an XML object is 0
>which returns the XML object (to blur the distinction between XMLList and
>XML). I think xmlList[0] is the same as xmlList[0][0][0][0]...
>I think I’m just going to ignore this part of the spec because I’m
>storing everything in a _children array and dealing with that.
>On Feb 7, 2016, at 6:59 PM, Andy Dufilie <andy.dufilie@gmail.com> wrote:
>> The insert code looks fine to me, assuming children of XML are stored as
>> properties "0", "1", "2", ...
>> It's shifting all children with index >= i and saving P starting at
>> index i.
>> [[Put]] is overwriting a child at a given index, and
>> insertChildBefore/insertChildAfter/prependChild should be doing the same
>> type of operation as insert.

View raw message