XML appendChild
Why doesn't appendChild always go to the end?
/**
* Copyright wh0 ( http://wonderfl.net/user/wh0 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/g0Dv
*/
package {
import com.actionscriptbible.Example;
public class FlashTest extends Example {
public function FlashTest() {
trace2 = trace;
new C().foo();
}
}
}
internal var trace2:Function;
internal var NOTHING:XML = XML('');
internal class A {
public function foo():XML {
var x:XML = <foo />;
x.appendChild(
bar('one') +
NOTHING
);
return x;
}
protected function bar(id:String):XML {
return (<bar id={id} />);
}
}
internal class B extends A {
override public function foo():XML {
var x:XML = super.foo();
x.appendChild(
bar('two') +
NOTHING
);
return x;
}
}
internal class C extends B {
override public function foo():XML {
var x:XML = super.foo();
trace2('C.foo starts with:\n' + x + '\n');
x.appendChild(
bar('three')
);
trace2('C.foo returns:\n' + x + '\n');
return x;
}
}