diff --git a/src/runner/instance.rs b/src/runner/instance.rs index 448adc2..5ef7b6a 100644 --- a/src/runner/instance.rs +++ b/src/runner/instance.rs @@ -66,6 +66,17 @@ impl mlua::UserData for Instance{ Ok(children) }) ); + methods.add_method("GetDescendants",|lua,this,_:()| + dom(lua,|dom|{ + let children:Vec<_>=dom + .descendants_of(this.referent) + .map(|instance| + Instance::new(instance.referent()) + ) + .collect(); + Ok(children) + }) + ); methods.add_method("IsA",|lua,this,classname:mlua::String| dom(lua,|dom|{ let instance=this.get(dom)?;