avm2: Implement XML.prependChild
This commit is contained in:
parent
53ba75d587
commit
9c7eb90d69
|
@ -72,6 +72,7 @@ package {
|
||||||
AS3 native function attribute(name:*):XMLList;
|
AS3 native function attribute(name:*):XMLList;
|
||||||
AS3 native function nodeKind():String;
|
AS3 native function nodeKind():String;
|
||||||
AS3 native function appendChild(child:Object):XML;
|
AS3 native function appendChild(child:Object):XML;
|
||||||
|
AS3 native function prependChild(child:Object):XML;
|
||||||
AS3 native function descendants(name:Object = "*"):XMLList;
|
AS3 native function descendants(name:Object = "*"):XMLList;
|
||||||
AS3 native function text():XMLList;
|
AS3 native function text():XMLList;
|
||||||
AS3 native function toString():String;
|
AS3 native function toString():String;
|
||||||
|
@ -189,6 +190,11 @@ package {
|
||||||
return self.AS3::appendChild(child);
|
return self.AS3::appendChild(child);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
prototype.prependChild = function(child:Object):XML {
|
||||||
|
var self:XML = this;
|
||||||
|
return self.AS3::prependChild(child);
|
||||||
|
};
|
||||||
|
|
||||||
prototype.descendants = function(name:Object):XMLList {
|
prototype.descendants = function(name:Object):XMLList {
|
||||||
var self:XML = this;
|
var self:XML = this;
|
||||||
return self.AS3::descendants(name);
|
return self.AS3::descendants(name);
|
||||||
|
|
|
@ -386,6 +386,21 @@ pub fn append_child<'gc>(
|
||||||
Ok(this.into())
|
Ok(this.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ECMA-357 13.4.4.29 XML.prototype.prependChild ( value )
|
||||||
|
pub fn prepend_child<'gc>(
|
||||||
|
activation: &mut Activation<'_, 'gc>,
|
||||||
|
this: Object<'gc>,
|
||||||
|
args: &[Value<'gc>],
|
||||||
|
) -> Result<Value<'gc>, Error<'gc>> {
|
||||||
|
let xml = this.as_xml_object().unwrap();
|
||||||
|
let child = args.get_value(0);
|
||||||
|
// 1. Call the [[Insert]] method of this object with arguments "0" and value
|
||||||
|
xml.node().insert(0, child, activation)?;
|
||||||
|
|
||||||
|
// 2. Return x
|
||||||
|
Ok(xml.into())
|
||||||
|
}
|
||||||
|
|
||||||
pub fn descendants<'gc>(
|
pub fn descendants<'gc>(
|
||||||
activation: &mut Activation<'_, 'gc>,
|
activation: &mut Activation<'_, 'gc>,
|
||||||
this: Object<'gc>,
|
this: Object<'gc>,
|
||||||
|
|
|
@ -1,2 +1 @@
|
||||||
num_ticks = 1
|
num_ticks = 1
|
||||||
known_failure = true
|
|
||||||
|
|
|
@ -1,2 +1 @@
|
||||||
num_ticks = 1
|
num_ticks = 1
|
||||||
known_failure = true
|
|
||||||
|
|
Loading…
Reference in New Issue