forked from: XML appendChild
forked from XML appendChild (diff: 2)
workaround...
ActionScript3 source code
/**
* Copyright wh0 ( http://wonderfl.net/user/wh0 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/9zK6
*/
// forked from wh0's XML appendChild
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();
x.normalize();
trace2('C.foo starts with:\n' + x + '\n');
x.appendChild(
bar('three')
);
trace2('C.foo returns:\n' + x + '\n');
return x;
}
}