mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
find_node_by_unique_id should use find
find_node_by_unique_id should use find instead of for-loop
This commit is contained in:
parent
83b2388ef4
commit
cad3115708
1 changed files with 1 additions and 9 deletions
|
@ -40,15 +40,7 @@ use util::str::DOMString;
|
|||
fn find_node_by_unique_id(page: &Rc<Page>, pipeline: PipelineId, node_id: String) -> Option<Root<Node>> {
|
||||
let page = get_page(&*page, pipeline);
|
||||
let document = page.document();
|
||||
let node = document.upcast::<Node>();
|
||||
|
||||
for candidate in node.traverse_preorder() {
|
||||
if candidate.get_unique_id() == node_id {
|
||||
return Some(candidate);
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
document.upcast::<Node>().traverse_preorder().find(|candidate| candidate.get_unique_id() == node_id)
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue