mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Auto merge of #7531 - nox:template, r=Ms2ger
Implement <template> All tests using iframes can't currently pass, same for innerHTML-related tests with <template> elements. The latter contradicts the spec, see the links below. Apart from this, they work, AFAICT. https://github.com/servo/html5ever/issues/164 https://www.w3.org/Bugs/Public/show_bug.cgi?id=27314 <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7531) <!-- Reviewable:end -->
This commit is contained in:
commit
5a0be12e43
28 changed files with 268 additions and 57 deletions
|
@ -155,6 +155,9 @@ pub struct Document {
|
|||
reflow_timeout: Cell<Option<u64>>,
|
||||
/// The cached first `base` element with an `href` attribute.
|
||||
base_element: MutNullableHeap<JS<HTMLBaseElement>>,
|
||||
/// This field is set to the document itself for inert documents.
|
||||
/// https://html.spec.whatwg.org/multipage/#appropriate-template-contents-owner-document
|
||||
appropriate_template_contents_owner_document: MutNullableHeap<JS<Document>>,
|
||||
}
|
||||
|
||||
impl PartialEq for Document {
|
||||
|
@ -1058,6 +1061,7 @@ impl Document {
|
|||
current_parser: Default::default(),
|
||||
reflow_timeout: Cell::new(None),
|
||||
base_element: Default::default(),
|
||||
appropriate_template_contents_owner_document: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1106,6 +1110,23 @@ impl Document {
|
|||
.and_then(HTMLHtmlElementCast::to_ref)
|
||||
.map(Root::from_ref)
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#appropriate-template-contents-owner-document
|
||||
pub fn appropriate_template_contents_owner_document(&self) -> Root<Document> {
|
||||
self.appropriate_template_contents_owner_document.or_init(|| {
|
||||
let doctype = if self.is_html_document {
|
||||
IsHTMLDocument::HTMLDocument
|
||||
} else {
|
||||
IsHTMLDocument::NonHTMLDocument
|
||||
};
|
||||
let new_doc = Document::new(
|
||||
&*self.window(), None, doctype, None, None,
|
||||
DocumentSource::NotFromParser, DocumentLoader::new(&self.loader()));
|
||||
new_doc.appropriate_template_contents_owner_document.set(
|
||||
Some(JS::from_ref(&*new_doc)));
|
||||
new_doc
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -13,19 +13,18 @@ use dom::bindings::codegen::Bindings::ElementBinding;
|
|||
use dom::bindings::codegen::Bindings::ElementBinding::ElementMethods;
|
||||
use dom::bindings::codegen::Bindings::EventBinding::EventMethods;
|
||||
use dom::bindings::codegen::Bindings::HTMLInputElementBinding::HTMLInputElementMethods;
|
||||
use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods;
|
||||
use dom::bindings::codegen::Bindings::NamedNodeMapBinding::NamedNodeMapMethods;
|
||||
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
||||
use dom::bindings::codegen::InheritTypes::CharacterDataCast;
|
||||
use dom::bindings::codegen::InheritTypes::DocumentDerived;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLAnchorElementCast;
|
||||
use dom::bindings::codegen::InheritTypes::TextCast;
|
||||
use dom::bindings::codegen::InheritTypes::{ElementCast, ElementDerived, EventTargetCast};
|
||||
use dom::bindings::codegen::InheritTypes::{CharacterDataCast, DocumentDerived, ElementCast};
|
||||
use dom::bindings::codegen::InheritTypes::{ElementDerived, EventTargetCast, HTMLAnchorElementCast};
|
||||
use dom::bindings::codegen::InheritTypes::{HTMLBodyElementDerived, HTMLFontElementDerived};
|
||||
use dom::bindings::codegen::InheritTypes::{HTMLIFrameElementDerived, HTMLInputElementCast};
|
||||
use dom::bindings::codegen::InheritTypes::{HTMLInputElementDerived, HTMLTableElementCast};
|
||||
use dom::bindings::codegen::InheritTypes::{HTMLTableElementDerived, HTMLTableCellElementDerived};
|
||||
use dom::bindings::codegen::InheritTypes::{HTMLTableRowElementDerived, HTMLTextAreaElementDerived};
|
||||
use dom::bindings::codegen::InheritTypes::{HTMLTableSectionElementDerived, NodeCast};
|
||||
use dom::bindings::codegen::InheritTypes::{HTMLTableRowElementDerived, HTMLTableSectionElementDerived};
|
||||
use dom::bindings::codegen::InheritTypes::{HTMLTemplateElementCast, HTMLTextAreaElementDerived};
|
||||
use dom::bindings::codegen::InheritTypes::{NodeCast, TextCast};
|
||||
use dom::bindings::codegen::UnionTypes::NodeOrString;
|
||||
use dom::bindings::error::Error::NoModificationAllowed;
|
||||
use dom::bindings::error::Error::{InvalidCharacter, Syntax};
|
||||
|
@ -1280,19 +1279,25 @@ impl ElementMethods for Element {
|
|||
node.get_client_rect().size.height
|
||||
}
|
||||
|
||||
// https://dvcs.w3.org/hg/innerhtml/raw-file/tip/index.html#widl-Element-innerHTML
|
||||
/// https://w3c.github.io/DOM-Parsing/#widl-Element-innerHTML
|
||||
fn GetInnerHTML(&self) -> Fallible<DOMString> {
|
||||
//XXX TODO: XML case
|
||||
self.serialize(ChildrenOnly)
|
||||
}
|
||||
|
||||
// https://dvcs.w3.org/hg/innerhtml/raw-file/tip/index.html#widl-Element-innerHTML
|
||||
/// https://w3c.github.io/DOM-Parsing/#widl-Element-innerHTML
|
||||
fn SetInnerHTML(&self, value: DOMString) -> Fallible<()> {
|
||||
let context_node = NodeCast::from_ref(self);
|
||||
// Step 1.
|
||||
let frag = try!(context_node.parse_fragment(value));
|
||||
// Step 2.
|
||||
Node::replace_all(Some(NodeCast::from_ref(frag.r())), context_node);
|
||||
// https://github.com/w3c/DOM-Parsing/issues/1
|
||||
let target = if let Some(template) = HTMLTemplateElementCast::to_ref(self) {
|
||||
NodeCast::from_root(template.Content())
|
||||
} else {
|
||||
Root::from_ref(context_node)
|
||||
};
|
||||
Node::replace_all(Some(NodeCast::from_ref(&*frag)), &target);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
@ -2,19 +2,28 @@
|
|||
* 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::InheritTypes::HTMLTemplateElementDerived;
|
||||
use dom::bindings::js::Root;
|
||||
use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods;
|
||||
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
||||
use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLTemplateElementCast};
|
||||
use dom::bindings::codegen::InheritTypes::{HTMLTemplateElementDerived, NodeCast};
|
||||
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::{CloneChildrenFlag, Node, NodeTypeId, document_from_node};
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
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 +40,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 +53,47 @@ 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()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl VirtualMethods for HTMLTemplateElement {
|
||||
fn super_type(&self) -> Option<&VirtualMethods> {
|
||||
Some(HTMLElementCast::from_ref(self) as &VirtualMethods)
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#template-adopting-steps
|
||||
fn adopting_steps(&self, old_doc: &Document) {
|
||||
self.super_type().unwrap().adopting_steps(old_doc);
|
||||
// Step 1.
|
||||
let doc = document_from_node(self).appropriate_template_contents_owner_document();
|
||||
// Step 2.
|
||||
Node::adopt(NodeCast::from_ref(&*self.Content()), &doc);
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#the-template-element:concept-node-clone-ext
|
||||
fn cloning_steps(&self, copy: &Node, maybe_doc: Option<&Document>,
|
||||
clone_children: CloneChildrenFlag) {
|
||||
self.super_type().unwrap().cloning_steps(copy, maybe_doc, clone_children);
|
||||
if clone_children == CloneChildrenFlag::DoNotCloneChildren {
|
||||
// Step 1.
|
||||
return;
|
||||
}
|
||||
let copy = HTMLTemplateElementCast::to_ref(copy).unwrap();
|
||||
// Steps 2-3.
|
||||
let copy_contents = NodeCast::from_root(copy.Content());
|
||||
let copy_contents_doc = copy_contents.owner_doc();
|
||||
for child in NodeCast::from_root(self.Content()).children() {
|
||||
let copy_child = Node::clone(
|
||||
&child, Some(©_contents_doc), CloneChildrenFlag::CloneChildren);
|
||||
copy_contents.AppendChild(©_child).unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1415,24 +1415,19 @@ impl Node {
|
|||
// https://dom.spec.whatwg.org/#concept-node-adopt
|
||||
pub fn adopt(node: &Node, document: &Document) {
|
||||
// Step 1.
|
||||
let parent_node = node.GetParentNode();
|
||||
match parent_node {
|
||||
Some(ref parent) => {
|
||||
Node::remove(node, parent, SuppressObserver::Unsuppressed);
|
||||
}
|
||||
None => (),
|
||||
}
|
||||
|
||||
let old_doc = node.owner_doc();
|
||||
// Step 2.
|
||||
let node_doc = document_from_node(node);
|
||||
if node_doc.r() != document {
|
||||
node.remove_self();
|
||||
if &*old_doc != document {
|
||||
// Step 3.
|
||||
for descendant in node.traverse_preorder() {
|
||||
descendant.r().set_owner_doc(document);
|
||||
descendant.set_owner_doc(document);
|
||||
}
|
||||
// Step 4.
|
||||
for descendant in node.traverse_preorder() {
|
||||
vtable_for(&descendant).adopting_steps(&old_doc);
|
||||
}
|
||||
}
|
||||
|
||||
// Step 3.
|
||||
// If node is an element, it is _affected by a base URL change_.
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
|
||||
|
|
|
@ -30,6 +30,7 @@ use dom::bindings::codegen::InheritTypes::HTMLTableCellElementCast;
|
|||
use dom::bindings::codegen::InheritTypes::HTMLTableElementCast;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLTableRowElementCast;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLTableSectionElementCast;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLTemplateElementCast;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLTextAreaElementCast;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLTitleElementCast;
|
||||
use dom::document::Document;
|
||||
|
@ -98,7 +99,14 @@ pub trait VirtualMethods {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://dom.spec.whatwg.org/#concept-node-clone (step 5)
|
||||
/// https://dom.spec.whatwg.org/#concept-node-adopt-ext
|
||||
fn adopting_steps(&self, old_doc: &Document) {
|
||||
if let Some(ref s) = self.super_type() {
|
||||
s.adopting_steps(old_doc);
|
||||
}
|
||||
}
|
||||
|
||||
/// https://dom.spec.whatwg.org/#concept-node-clone-ext
|
||||
fn cloning_steps(&self, copy: &Node, maybe_doc: Option<&Document>,
|
||||
clone_children: CloneChildrenFlag) {
|
||||
if let Some(ref s) = self.super_type() {
|
||||
|
@ -216,6 +224,9 @@ pub fn vtable_for<'a>(node: &'a Node) -> &'a (VirtualMethods + 'a) {
|
|||
HTMLTableSectionElementCast::to_ref(node).unwrap();
|
||||
element as &'a (VirtualMethods + 'a)
|
||||
}
|
||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTemplateElement)) => {
|
||||
HTMLTemplateElementCast::to_ref(node).unwrap() as &'a (VirtualMethods + 'a)
|
||||
}
|
||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTextAreaElement)) => {
|
||||
let element = HTMLTextAreaElementCast::to_ref(node).unwrap();
|
||||
element as &'a (VirtualMethods + 'a)
|
||||
|
|
|
@ -5,5 +5,5 @@
|
|||
|
||||
// https://www.whatwg.org/html/#htmltemplateelement
|
||||
interface HTMLTemplateElement : HTMLElement {
|
||||
//readonly attribute DocumentFragment content;
|
||||
readonly attribute DocumentFragment content;
|
||||
};
|
||||
|
|
|
@ -6,11 +6,12 @@
|
|||
|
||||
use document_loader::DocumentLoader;
|
||||
use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
|
||||
use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods;
|
||||
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
||||
use dom::bindings::codegen::InheritTypes::ProcessingInstructionCast;
|
||||
use dom::bindings::codegen::InheritTypes::{CharacterDataCast, DocumentTypeCast};
|
||||
use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLScriptElementCast};
|
||||
use dom::bindings::codegen::InheritTypes::{HTMLFormElementDerived, NodeCast};
|
||||
use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLFormElementDerived};
|
||||
use dom::bindings::codegen::InheritTypes::{HTMLScriptElementCast, HTMLTemplateElementCast};
|
||||
use dom::bindings::codegen::InheritTypes::{NodeCast, ProcessingInstructionCast};
|
||||
use dom::bindings::js::{JS, Root};
|
||||
use dom::bindings::js::{RootedReference};
|
||||
use dom::characterdata::CharacterDataTypeId;
|
||||
|
@ -43,12 +44,20 @@ use util::str::DOMString;
|
|||
|
||||
impl<'a> TreeSink for servohtmlparser::Sink {
|
||||
type Handle = JS<Node>;
|
||||
|
||||
fn get_document(&mut self) -> JS<Node> {
|
||||
let doc = self.document.root();
|
||||
let node = NodeCast::from_ref(doc.r());
|
||||
JS::from_ref(node)
|
||||
}
|
||||
|
||||
fn get_template_contents(&self, target: JS<Node>) -> JS<Node> {
|
||||
let target = target.root();
|
||||
let template = HTMLTemplateElementCast::to_ref(&*target)
|
||||
.expect("tried to get template contents of non-HTMLTemplateElement in HTML parsing");
|
||||
JS::from_ref(NodeCast::from_ref(&*template.Content()))
|
||||
}
|
||||
|
||||
fn same_node(&self, x: JS<Node>, y: JS<Node>) -> bool {
|
||||
x == y
|
||||
}
|
||||
|
@ -194,7 +203,14 @@ impl<'a> Serializable for &'a Node {
|
|||
try!(serializer.start_elem(name.clone(), attr_refs));
|
||||
}
|
||||
|
||||
for handle in node.children() {
|
||||
let children = if let Some(tpl) = HTMLTemplateElementCast::to_ref(node) {
|
||||
// https://github.com/w3c/DOM-Parsing/issues/1
|
||||
NodeCast::from_ref(&*tpl.Content()).children()
|
||||
} else {
|
||||
node.children()
|
||||
};
|
||||
|
||||
for handle in children {
|
||||
try!(handle.r().serialize(serializer, IncludeNode));
|
||||
}
|
||||
|
||||
|
|
6
components/servo/Cargo.lock
generated
6
components/servo/Cargo.lock
generated
|
@ -750,7 +750,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "html5ever"
|
||||
version = "0.2.3"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"html5ever_macros 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1375,7 +1375,7 @@ dependencies = [
|
|||
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"html5ever 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"html5ever 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)",
|
||||
"js 0.1.0 (git+https://github.com/servo/rust-mozjs)",
|
||||
|
@ -1738,7 +1738,7 @@ dependencies = [
|
|||
"cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"getopts 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"html5ever 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"html5ever 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)",
|
||||
"js 0.1.0 (git+https://github.com/servo/rust-mozjs)",
|
||||
|
|
6
ports/cef/Cargo.lock
generated
6
ports/cef/Cargo.lock
generated
|
@ -735,7 +735,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "html5ever"
|
||||
version = "0.2.3"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"html5ever_macros 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1345,7 +1345,7 @@ dependencies = [
|
|||
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"html5ever 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"html5ever 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)",
|
||||
"js 0.1.0 (git+https://github.com/servo/rust-mozjs)",
|
||||
|
@ -1699,7 +1699,7 @@ dependencies = [
|
|||
"cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"getopts 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"html5ever 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"html5ever 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)",
|
||||
"js 0.1.0 (git+https://github.com/servo/rust-mozjs)",
|
||||
|
|
6
ports/gonk/Cargo.lock
generated
6
ports/gonk/Cargo.lock
generated
|
@ -619,7 +619,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "html5ever"
|
||||
version = "0.2.3"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"html5ever_macros 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1211,7 +1211,7 @@ dependencies = [
|
|||
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"html5ever 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"html5ever 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)",
|
||||
"js 0.1.0 (git+https://github.com/servo/rust-mozjs)",
|
||||
|
@ -1534,7 +1534,7 @@ dependencies = [
|
|||
"cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"getopts 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"html5ever 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"html5ever 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)",
|
||||
"js 0.1.0 (git+https://github.com/servo/rust-mozjs)",
|
||||
|
|
|
@ -6333,9 +6333,6 @@
|
|||
[HTMLTemplateElement interface: existence and properties of interface object]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLTemplateElement interface: attribute content]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLCanvasElement interface: existence and properties of interface object]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -267,3 +267,6 @@
|
|||
[<picture><svg><!--<font face> tag breaks out of svg--><font face=""></font><source srcset="data:,b"></source></svg><img src="data:,a" data-expect="data:,b"></picture>]
|
||||
expected: FAIL
|
||||
|
||||
[<picture><svg><!--<font face> tag breaks out of svg--></svg><font face=""></font><source srcset="data:,b"><img src="data:,a" data-expect="data:,b"></picture>]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
disabled: for now
|
|
@ -0,0 +1 @@
|
|||
disabled: XHTML
|
|
@ -0,0 +1 @@
|
|||
disabled: XHTML
|
|
@ -0,0 +1,5 @@
|
|||
[templates-copy-document-owner.html]
|
||||
type: testharness
|
||||
[ownerDocument of cloned template content is set to template content owner. Test loading HTML document from file]
|
||||
expected: FAIL
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
[template-contents-owner-document-type.html]
|
||||
type: testharness
|
||||
[The template contents owner document type is HTML document (case when document has browsing context and the template is created by HTML parser)]
|
||||
expected: FAIL
|
||||
|
||||
[The template contents owner document type is HTML document (case when document has browsing context and the template is created by createElement())]
|
||||
expected: FAIL
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
[template-contents-owner-test-002.html]
|
||||
type: testharness
|
||||
[The template contents owner document must be different from template owner document, which has browsing context. Template element is created by createElement()]
|
||||
expected: FAIL
|
||||
|
||||
[The template contents owner document must be different from template owner document, which has browsing context. Template element is created via innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
[The template contents owner document must be different from template owner document, which has browsing context. Template element is created by HTML parser]
|
||||
expected: FAIL
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
[template-contents.html]
|
||||
type: testharness
|
||||
[The template contents must be a DocumentFragment (the empty template tag inside HTML file loaded in iframe)]
|
||||
expected: FAIL
|
||||
|
||||
[The template contents must be a DocumentFragment (non empty template tag inside HTML file loaded in iframe)]
|
||||
expected: FAIL
|
||||
|
||||
[The template contents must be a DocumentFragment (the template tag with some text inside HTML file loaded in iframe)]
|
||||
expected: FAIL
|
||||
|
||||
[The template contents must be a DocumentFragment (the template tag with nested template tag inside HTML file loaded in iframe)]
|
||||
expected: FAIL
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
[innerhtml.html]
|
||||
type: testharness
|
||||
[innerHTML of template element replaces all referenced by the content attribute. Test loading of HTML document from a file]
|
||||
expected: FAIL
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
[content-attribute.html]
|
||||
type: testharness
|
||||
[Content attribute of template element is read-only. Text value of content attribute of template tag should be ignored, when loading document from a file]
|
||||
expected: FAIL
|
||||
|
||||
[Content attribute of template element is read-only. Test content attribute of a document loaded from a file]
|
||||
expected: FAIL
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
[node-document-changes.html]
|
||||
type: testharness
|
||||
[Changing of template element's node document. Test document loaded from a file]
|
||||
expected: FAIL
|
||||
|
||||
[Changing of template element's node document. Adobt template element into a document that has a browsing context]
|
||||
expected: FAIL
|
||||
|
||||
[Changing of template element's node document. Test the case when both old and new owner documents of template element have browsing context]
|
||||
expected: FAIL
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
[template-as-a-descendant.html]
|
||||
type: testharness
|
||||
[Template element as a descendant of the FRAMESET element. Template element is created by innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
[Template element as an indirect descendant of the FRAMESET element. Template element is created by innerHTML]
|
||||
expected: FAIL
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
[template-content-node-document.html]
|
||||
type: testharness
|
||||
[Node document of the template content attribute must be template contents owner. Load HTML file with multiple template elements]
|
||||
expected: FAIL
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
[template-descendant-body.html]
|
||||
type: testharness
|
||||
[Template element as a descendant of the body element. Test loading from a file]
|
||||
expected: FAIL
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
[template-descendant-frameset.html]
|
||||
type: testharness
|
||||
[Template element as a descendant of the frameset element. Test loading from a file]
|
||||
expected: FAIL
|
||||
|
||||
[Template element as a descendant of the frameset element. Test template element is assigned to frameset's innerHTML)]
|
||||
expected: FAIL
|
||||
|
||||
[Template element as a descendant of the frameset element. Test template element appended to frameset by appendChild()]
|
||||
expected: FAIL
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
[template-descendant-head.html]
|
||||
type: testharness
|
||||
[Template element as a descendant of the head element. Test loading from a file]
|
||||
expected: FAIL
|
||||
|
|
@ -17,9 +17,12 @@
|
|||
testInIFrame('../resources/template-contents.html', function(context) {
|
||||
var doc = context.iframes[0].contentDocument;
|
||||
var template = doc.querySelector('template');
|
||||
var content_owner = template.content.ownerDocument;
|
||||
|
||||
assert_class_string(template.content.ownerDocument, 'HTMLDocument',
|
||||
'Template content owner should be a HTML document');
|
||||
assert_class_string(content_owner, 'Document',
|
||||
'Template content owner should be a document');
|
||||
assert_equals(content_owner.createElement('DIV').localName, 'div',
|
||||
'Template content owner should be an HTML document');
|
||||
|
||||
}, 'The template contents owner document type is HTML document ' +
|
||||
'(case when document has browsing context and the template ' +
|
||||
|
@ -29,13 +32,16 @@ testInIFrame('../resources/template-contents.html', function(context) {
|
|||
testInIFrame('../resources/template-contents.html', function(context) {
|
||||
var doc = context.iframes[0].contentDocument;
|
||||
var template = doc.createElement('template');
|
||||
var div = doc.createElement('div');
|
||||
var content_owner = template.content.ownerDocument;
|
||||
var div = doc.createElement('DIV');
|
||||
template.appendChild(div);
|
||||
|
||||
doc.body.appendChild(template);
|
||||
|
||||
assert_class_string(template.content.ownerDocument, 'HTMLDocument',
|
||||
'Template content owner should be a HTML document');
|
||||
assert_class_string(content_owner, 'Document',
|
||||
'Template content owner should be a document');
|
||||
assert_equals(div.localName, 'div',
|
||||
'Template content owner should be an HTML document');
|
||||
|
||||
}, 'The template contents owner document type is HTML document ' +
|
||||
'(case when document has browsing context and the template ' +
|
||||
|
@ -45,13 +51,16 @@ testInIFrame('../resources/template-contents.html', function(context) {
|
|||
test(function() {
|
||||
var doc = newHTMLDocument();
|
||||
var template = doc.createElement('template');
|
||||
var div = doc.createElement('div');
|
||||
var content_owner = template.content.ownerDocument;
|
||||
var div = doc.createElement('DIV');
|
||||
template.appendChild(div);
|
||||
|
||||
doc.body.appendChild(template);
|
||||
|
||||
assert_class_string(template.content.ownerDocument, 'HTMLDocument',
|
||||
'Template content owner should be a HTML document');
|
||||
assert_class_string(content_owner, 'Document',
|
||||
'Template content owner should be a document');
|
||||
assert_equals(div.localName, 'div',
|
||||
'Template content owner should be an HTML document');
|
||||
|
||||
}, 'The template contents owner document type is HTML document ' +
|
||||
'(case when document has no browsing context and the template is created ' +
|
||||
|
@ -61,9 +70,12 @@ test(function() {
|
|||
var doc = newHTMLDocument();
|
||||
doc.body.innerHTML = '<template><div>Hello!</div></template>';
|
||||
var template = doc.querySelector('template');
|
||||
var content_owner = template.content.ownerDocument;
|
||||
|
||||
assert_class_string(template.content.ownerDocument, 'HTMLDocument',
|
||||
'Template content owner should be a HTML document');
|
||||
assert_class_string(content_owner, 'Document',
|
||||
'Template content owner should be a document');
|
||||
assert_equals(content_owner.createElement('DIV').localName, 'div',
|
||||
'Template content owner should be an HTML document');
|
||||
|
||||
}, 'The template contents owner document type is HTML document ' +
|
||||
'(case when document has no browsing context and the template is created via innerHTML)');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue