script: Avoid a temporary when constructing <td> and <tr> elements.

Was a huge improvement to RoboHornet.
This commit is contained in:
Patrick Walton 2014-10-28 11:14:06 -07:00
parent 5e9127e2b2
commit 6f577c7c84
2 changed files with 12 additions and 6 deletions

View file

@ -32,9 +32,13 @@ impl HTMLTableDataCellElement {
} }
#[allow(unrooted_must_root)] #[allow(unrooted_must_root)]
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLTableDataCellElement> { pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>)
let element = HTMLTableDataCellElement::new_inherited(localName, prefix, document); -> Temporary<HTMLTableDataCellElement> {
Node::reflect_node(box element, document, HTMLTableDataCellElementBinding::Wrap) Node::reflect_node(box HTMLTableDataCellElement::new_inherited(localName,
prefix,
document),
document,
HTMLTableDataCellElementBinding::Wrap)
} }
} }

View file

@ -32,9 +32,11 @@ impl HTMLTableRowElement {
} }
#[allow(unrooted_must_root)] #[allow(unrooted_must_root)]
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLTableRowElement> { pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>)
let element = HTMLTableRowElement::new_inherited(localName, prefix, document); -> Temporary<HTMLTableRowElement> {
Node::reflect_node(box element, document, HTMLTableRowElementBinding::Wrap) Node::reflect_node(box HTMLTableRowElement::new_inherited(localName, prefix, document),
document,
HTMLTableRowElementBinding::Wrap)
} }
} }