parent
2d9c1a3829
commit
3d29b81a8c
|
@ -294,7 +294,11 @@ impl<'gc> E4XNode<'gc> {
|
|||
}
|
||||
|
||||
pub fn matches_name(&self, name: &Multiname<'gc>) -> bool {
|
||||
// FIXME - we need to handle namespaces heere
|
||||
// FIXME - we need to handle namespaces here
|
||||
if name.is_any_name() {
|
||||
return true;
|
||||
}
|
||||
|
||||
if let Some(local_name) = self.local_name() {
|
||||
Some(local_name) == name.local_name()
|
||||
} else {
|
||||
|
|
|
@ -118,35 +118,34 @@ impl<'gc> TObject<'gc> for XmlObject<'gc> {
|
|||
return Ok(Value::Undefined);
|
||||
}
|
||||
}
|
||||
|
||||
let matched_children = if let E4XNodeKind::Element {
|
||||
children,
|
||||
attributes,
|
||||
} = &*read.node.kind()
|
||||
{
|
||||
let search_children = if name.is_attribute() {
|
||||
attributes
|
||||
} else {
|
||||
children
|
||||
};
|
||||
|
||||
search_children
|
||||
.iter()
|
||||
.filter_map(|child| {
|
||||
if child.matches_name(name) {
|
||||
Some(E4XOrXml::E4X(*child))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
} else {
|
||||
Vec::new()
|
||||
};
|
||||
return Ok(
|
||||
XmlListObject::new(activation, matched_children, Some(self.into())).into(),
|
||||
);
|
||||
}
|
||||
|
||||
let matched_children = if let E4XNodeKind::Element {
|
||||
children,
|
||||
attributes,
|
||||
} = &*read.node.kind()
|
||||
{
|
||||
let search_children = if name.is_attribute() {
|
||||
attributes
|
||||
} else {
|
||||
children
|
||||
};
|
||||
|
||||
search_children
|
||||
.iter()
|
||||
.filter_map(|child| {
|
||||
if child.matches_name(name) {
|
||||
Some(E4XOrXml::E4X(*child))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
} else {
|
||||
Vec::new()
|
||||
};
|
||||
|
||||
return Ok(XmlListObject::new(activation, matched_children, Some(self.into())).into());
|
||||
}
|
||||
|
||||
read.base.get_property_local(name, activation)
|
||||
|
|
Loading…
Reference in New Issue