Harbs,

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>;
                trace(xml.length());


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.

Thoughts?
-Alex

On 2/7/16, 9:38 AM, "Harbs" <harbs.li...@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.dufi...@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
>>child
>> 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.
>

Reply via email to