mirror of
https://github.com/servo/servo.git
synced 2025-07-24 07:40:27 +01:00
Use util::str::str_join in more places
Instead of intermediate allocations of `Vec`s, we should utilize `str_join` which operates on iterators
This commit is contained in:
parent
2857e547be
commit
f14f09e886
4 changed files with 7 additions and 10 deletions
|
@ -18,7 +18,7 @@ use dom::htmlelement::{HTMLElement, HTMLElementTypeId};
|
|||
use dom::node::{Node, NodeTypeId};
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
use std::cell::Cell;
|
||||
use util::str::{DOMString, split_html_space_chars};
|
||||
use util::str::{DOMString, split_html_space_chars, str_join};
|
||||
|
||||
#[dom_struct]
|
||||
pub struct HTMLOptionElement {
|
||||
|
@ -93,8 +93,7 @@ impl HTMLOptionElementMethods for HTMLOptionElement {
|
|||
let node = NodeCast::from_ref(self);
|
||||
let mut content = String::new();
|
||||
collect_text(&node, &mut content);
|
||||
let v: Vec<&str> = split_html_space_chars(&content).collect();
|
||||
v.join(" ")
|
||||
str_join(split_html_space_chars(&content), " ")
|
||||
}
|
||||
|
||||
// https://www.whatwg.org/html/#dom-option-text
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue