mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Auto merge of #8403 - frewsxcv:node-from-nodes-and-strings, r=nox
Minor 'node_from_nodes_and_strings' cleanup <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8403) <!-- Reviewable:end -->
This commit is contained in:
commit
fc98b8e126
1 changed files with 6 additions and 7 deletions
|
@ -930,15 +930,14 @@ impl Document {
|
||||||
ReflowReason::KeyEvent);
|
ReflowReason::KeyEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn node_from_nodes_and_strings(&self, nodes: Vec<NodeOrString>)
|
// https://dom.spec.whatwg.org/#converting-nodes-into-a-node
|
||||||
|
pub fn node_from_nodes_and_strings(&self, mut nodes: Vec<NodeOrString>)
|
||||||
-> Fallible<Root<Node>> {
|
-> Fallible<Root<Node>> {
|
||||||
if nodes.len() == 1 {
|
if nodes.len() == 1 {
|
||||||
match nodes.into_iter().next().unwrap() {
|
Ok(match nodes.pop().unwrap() {
|
||||||
NodeOrString::eNode(node) => Ok(node),
|
NodeOrString::eNode(node) => node,
|
||||||
NodeOrString::eString(string) => {
|
NodeOrString::eString(string) => Root::upcast(self.CreateTextNode(string)),
|
||||||
Ok(Root::upcast(self.CreateTextNode(string)))
|
})
|
||||||
},
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
let fragment = Root::upcast::<Node>(self.CreateDocumentFragment());
|
let fragment = Root::upcast::<Node>(self.CreateDocumentFragment());
|
||||||
for node in nodes {
|
for node in nodes {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue