OK. You are right about this. When I do this: list1 += list4 + xml2.z;// leaving out xml2.z prevents the next line from adding <voo/> to the original xml list1[list1.length()] = <voo/>;
I get: <root xmlns:fz="http://ns.adobe.com/mxml/2009"> <bla/> <a name="fred"/> <a> hi <b>yeah!</b> </a> <a name="frank"/> <c id="1"/> <c/> <voo/> </root> So, anything added to the XMLList afterwards gets added to the original XML. I’m still having trouble with the spec, though. The spec has the following in [[Append]]: 3. If Type(V) is XMLList, a. Let x.[[TargetObject]] = V.[[TargetObject]] b. Let x.[[TargetProperty]] = V.[[TargetProperty]] c. Let n = V.[[Length]] d. If n == 0, Return e. For j = 0 to V.[[Length]]-1, let x[i + j] = V[j] Step e uses bracket assignment to the XMList of the values in the right-hand object. As I understand it, bracket assignment inserts the object into the target object as well. I think that’s what it says in [[Put]], but I’m not sure. Of course, with my understanding, a and b should be after step e. So, I’m somewhat confused there... Either way, I think we need to add a plus() method to XML and XMLList which does “the right thing” as described by 11.4.1 in the spec. I’m also not sure every case of addition is being handled correctly: 1. Number + XML/XMLList 2. XML/XMLList + Number 3. String + XML/XMLList 4. XML/XMLList + String 5. XML/XMLList + XML/XMLList On May 8, 2016, at 9:10 AM, Alex Harui <aha...@adobe.com> wrote: > > > On 5/7/16, 11:36 AM, "Harbs" <harbs.li...@gmail.com> wrote: > >> Right. I read that. This was what I was referring to in my last email. >> >> However, the Addition Operator is supposed to call [[Append]] and >> [[Append]] is supposed to assign the right side target object and target >> property to the left side object. So why doesn’t the original XML get >> effected? > > For which example? For list = list1 + list4, the steps are: > > temp = new XMLList(); > temp.append(list1) > temp.append(list4); > list1 = temp; > > temp is created with targetObject = null. > list4 has targetObject = null > > > But also, in re-reading the spec, I don't see where [[Append]] updates the > targetObject's properties and attributes. There is no mention of [[Put]], > for example. Maybe manipulation of the targetObject always happens on > some other assignment? > > -Alex >