diff --git a/components/script/webdriver_handlers.rs b/components/script/webdriver_handlers.rs index 1b1d92fc914..e51a2e23804 100644 --- a/components/script/webdriver_handlers.rs +++ b/components/script/webdriver_handlers.rs @@ -40,15 +40,7 @@ use util::str::DOMString; fn find_node_by_unique_id(page: &Rc, pipeline: PipelineId, node_id: String) -> Option> { let page = get_page(&*page, pipeline); let document = page.document(); - let node = document.upcast::(); - - for candidate in node.traverse_preorder() { - if candidate.get_unique_id() == node_id { - return Some(candidate); - } - } - - None + document.upcast::().traverse_preorder().find(|candidate| candidate.get_unique_id() == node_id) } #[allow(unsafe_code)]