avm1: Iterating xmlnode attributes should list every attribute
This commit is contained in:
parent
bcb64b9a62
commit
c5ac707fb5
|
@ -215,7 +215,9 @@ impl<'gc> TObject<'gc> for XMLAttributesObject<'gc> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_keys(&self, activation: &mut Activation<'_, 'gc, '_>) -> Vec<String> {
|
fn get_keys(&self, activation: &mut Activation<'_, 'gc, '_>) -> Vec<String> {
|
||||||
self.base().get_keys(activation)
|
let mut base = self.base().get_keys(activation);
|
||||||
|
base.extend(self.node().attribute_keys());
|
||||||
|
base
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_string(&self) -> Cow<str> {
|
fn as_string(&self) -> Cow<str> {
|
||||||
|
|
|
@ -1042,6 +1042,17 @@ impl<'gc> XMLNode<'gc> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Retrieve all keys defined on this node.
|
||||||
|
pub fn attribute_keys(self) -> Vec<String> {
|
||||||
|
match &*self.0.read() {
|
||||||
|
XMLNodeData::Element { attributes, .. } => attributes
|
||||||
|
.keys()
|
||||||
|
.map(|v| v.node_name().to_string())
|
||||||
|
.collect::<Vec<String>>(),
|
||||||
|
_ => Vec::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Retrieve the value of a single attribute on this node, case-insensitively.
|
/// Retrieve the value of a single attribute on this node, case-insensitively.
|
||||||
///
|
///
|
||||||
/// TODO: Probably won't need this when we have a proper HTML parser.
|
/// TODO: Probably won't need this when we have a proper HTML parser.
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
|
||||||
attr y string
|
attr y string
|
||||||
undefined
|
undefined
|
||||||
|
attrx
|
||||||
|
attry
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue