Most XML properties return `null`, not `undefined`.

Furthermore, `prefix` does not distinguish between `<test>` and `<:test>` - they both have a `prefix` of `""`.
This commit is contained in:
David Wendt 2019-12-22 00:21:02 -05:00
parent b491dd034e
commit cfacd397cf
1 changed files with 9 additions and 5 deletions

View File

@ -54,7 +54,7 @@ pub fn create_xmlnode_proto<'gc>(
.as_xml_node()
.and_then(|n| n.tag_name())
.map(|n| n.local_name().to_string().into())
.unwrap_or_else(|| Value::Undefined.into()))
.unwrap_or_else(|| Value::Null.into()))
}),
None,
ReadOnly.into(),
@ -67,7 +67,7 @@ pub fn create_xmlnode_proto<'gc>(
.as_xml_node()
.and_then(|n| n.tag_name())
.map(|n| n.node_name().into())
.unwrap_or_else(|| Value::Undefined.into()))
.unwrap_or_else(|| Value::Null.into()))
}),
None,
ReadOnly.into(),
@ -93,7 +93,7 @@ pub fn create_xmlnode_proto<'gc>(
.as_xml_node()
.and_then(|n| n.node_value())
.map(|n| n.into())
.unwrap_or_else(|| Value::Undefined.into()))
.unwrap_or_else(|| Value::Null.into()))
}),
None,
ReadOnly.into(),
@ -105,8 +105,12 @@ pub fn create_xmlnode_proto<'gc>(
Ok(this
.as_xml_node()
.and_then(|n| n.tag_name())
.and_then(|n| n.prefix().map(|n| n.to_string().into()))
.unwrap_or_else(|| Value::Undefined.into()))
.map(|n| {
n.prefix()
.map(|n| n.to_string().into())
.unwrap_or("".to_string().into())
})
.unwrap_or_else(|| Value::Null.into()))
}),
None,
ReadOnly.into(),