avm2: XML/XMLList is converted to a string when set as attribute value
This commit is contained in:
parent
1b03ce9ae6
commit
75566b92e0
|
@ -312,15 +312,6 @@ impl<'gc> TObject<'gc> for XmlObject<'gc> {
|
|||
|
||||
if name.is_attribute() {
|
||||
self.delete_property_local(activation, name)?;
|
||||
if let Some(obj) = value.as_object() {
|
||||
if obj.as_xml_object().is_some() || obj.as_xml_list_object().is_some() {
|
||||
return Err(format!(
|
||||
"Cannot set an XML/XMLList object {:?} as an attribute",
|
||||
obj
|
||||
)
|
||||
.into());
|
||||
}
|
||||
}
|
||||
let Some(local_name) = name.local_name() else {
|
||||
return Err(format!("Cannot set attribute {:?} without a local name", name).into());
|
||||
};
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package
|
||||
{
|
||||
import flash.display.Sprite;
|
||||
public class Test extends Sprite
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
var main:XML = <root><item>A</item></root>;
|
||||
|
||||
var part:XML = <hello><a>B</a><b>C</b></hello>;
|
||||
|
||||
trace(main);
|
||||
|
||||
main.item[0].@name = "Hello";
|
||||
|
||||
trace(main);
|
||||
|
||||
main.item[0].@name2 = part;
|
||||
|
||||
trace(main);
|
|
@ -0,0 +1,9 @@
|
|||
<root>
|
||||
<item>A</item>
|
||||
</root>
|
||||
<root>
|
||||
<item name="Hello">A</item>
|
||||
</root>
|
||||
<root>
|
||||
<item name="Hello" name2="<hello>
 <a>B</a>
 <b>C</b>
</hello>">A</item>
|
||||
</root>
|
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
num_ticks = 1
|
|
@ -0,0 +1,21 @@
|
|||
package
|
||||
{
|
||||
import flash.display.Sprite;
|
||||
public class Test extends Sprite
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
var main:XML = <root><item>A</item></root>;
|
||||
|
||||
var part:XMLList = new XMLList("<root><item>A</item><item>B</item></root>");
|
||||
|
||||
trace(main);
|
||||
|
||||
main.item[0].@name = "Hello";
|
||||
|
||||
trace(main);
|
||||
|
||||
main.item[0].@name2 = part;
|
||||
|
||||
trace(main);
|
|
@ -0,0 +1,9 @@
|
|||
<root>
|
||||
<item>A</item>
|
||||
</root>
|
||||
<root>
|
||||
<item name="Hello">A</item>
|
||||
</root>
|
||||
<root>
|
||||
<item name="Hello" name2="<root>
 <item>A</item>
 <item>B</item>
</root>">A</item>
|
||||
</root>
|
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
num_ticks = 1
|
Loading…
Reference in New Issue