mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Bump html5ever to 0.2.4, <template> support!
The failing <img> test comes from the now-correct parsing of <font face> elements in SVG.
This commit is contained in:
parent
880364b56d
commit
a7476a758e
17 changed files with 117 additions and 55 deletions
|
@ -2,19 +2,25 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
|
||||
use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding;
|
||||
use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLTemplateElementDerived;
|
||||
use dom::bindings::js::Root;
|
||||
use dom::bindings::js::{JS, MutNullableHeap, Root};
|
||||
use dom::document::Document;
|
||||
use dom::documentfragment::DocumentFragment;
|
||||
use dom::element::ElementTypeId;
|
||||
use dom::eventtarget::{EventTarget, EventTargetTypeId};
|
||||
use dom::htmlelement::{HTMLElement, HTMLElementTypeId};
|
||||
use dom::node::{Node, NodeTypeId};
|
||||
use dom::node::{Node, NodeTypeId, document_from_node};
|
||||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct HTMLTemplateElement {
|
||||
htmlelement: HTMLElement,
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#template-contents
|
||||
contents: MutNullableHeap<JS<DocumentFragment>>,
|
||||
}
|
||||
|
||||
impl HTMLTemplateElementDerived for EventTarget {
|
||||
|
@ -31,7 +37,8 @@ impl HTMLTemplateElement {
|
|||
document: &Document) -> HTMLTemplateElement {
|
||||
HTMLTemplateElement {
|
||||
htmlelement:
|
||||
HTMLElement::new_inherited(HTMLElementTypeId::HTMLTemplateElement, localName, prefix, document)
|
||||
HTMLElement::new_inherited(HTMLElementTypeId::HTMLTemplateElement, localName, prefix, document),
|
||||
contents: MutNullableHeap::new(None),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,3 +50,13 @@ impl HTMLTemplateElement {
|
|||
Node::reflect_node(box element, document, HTMLTemplateElementBinding::Wrap)
|
||||
}
|
||||
}
|
||||
|
||||
impl HTMLTemplateElementMethods for HTMLTemplateElement {
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-template-content
|
||||
fn Content(&self) -> Root<DocumentFragment> {
|
||||
self.contents.or_init(|| {
|
||||
let doc = document_from_node(self);
|
||||
doc.appropriate_template_contents_owner_document().CreateDocumentFragment()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue