diff options
Diffstat (limited to 'components/script/webdriver_handlers.rs')
-rw-r--r-- | components/script/webdriver_handlers.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/components/script/webdriver_handlers.rs b/components/script/webdriver_handlers.rs index cd49c8126f7..0bf2ede1aeb 100644 --- a/components/script/webdriver_handlers.rs +++ b/components/script/webdriver_handlers.rs @@ -203,6 +203,21 @@ pub fn handle_get_name(page: &Rc<Page>, }).unwrap(); } +pub fn handle_get_attribute(page: &Rc<Page>, + pipeline: PipelineId, + node_id: String, + name: String, + reply: IpcSender<Result<Option<String>, ()>>) { + reply.send(match find_node_by_unique_id(&*page, pipeline, node_id) { + Some(node) => { + Ok(node.downcast::<Element>().unwrap().GetAttribute(DOMString::from(name)) + .map(String::from)) + }, + None => Err(()) + }).unwrap(); +} + + pub fn handle_get_url(page: &Rc<Page>, _pipeline: PipelineId, reply: IpcSender<Url>) { |