Fix insert-adjacent error

This commit is contained in:
Guillaume Gomez 2016-06-23 15:06:27 +02:00
parent 0fb5d634a0
commit fc88f81de3
5 changed files with 3 additions and 73 deletions

View file

@ -2069,14 +2069,14 @@ impl ElementMethods for Element {
let context = match context.downcast::<Element>() {
Some(elem) if elem.local_name() != &atom!("html") ||
!elem.html_element_in_html_document() => Root::from_ref(elem),
_ => Root::upcast(HTMLBodyElement::new(atom!("body"), None, &*context.owner_doc()))
_ => Root::upcast(HTMLBodyElement::new(atom!("body"), None, &*context.owner_doc())),
};
// Step 3.
let fragment = try!(context.upcast::<Node>().parse_fragment(text));
// Step 4.
context.insert_adjacent(position, fragment.upcast()).map(|_| ())
self.insert_adjacent(position, fragment.upcast()).map(|_| ())
}
}

View file

@ -1,8 +0,0 @@
[insert-adjacent.html]
type: testharness
[insertAdjacentHTML(beforebegin, <h3>beforebegin</h3> )]
expected: FAIL
[insertAdjacentHTML(afterend, <h3>afterend</h3> )]
expected: FAIL

View file

@ -1,32 +0,0 @@
[insert_adjacent_html.html]
type: testharness
[beforeBegin content without next sibling]
expected: FAIL
[afterend content without next sibling]
expected: FAIL
[beforeBegin content again, with next sibling]
expected: FAIL
[afterend content again, with next sibling]
expected: FAIL
[beforeBegin child node not in tree but has parent]
expected: FAIL
[afterend child node not in tree but has parent]
expected: FAIL
[beforeBegin content2 without next sibling]
expected: FAIL
[afterend content2 without next sibling]
expected: FAIL
[beforeBegin content2 test again, now that there's a next sibling]
expected: FAIL
[afterend content2 test again, now that there's a next sibling]
expected: FAIL

View file

@ -1,35 +1,5 @@
[insert_adjacent_html.xhtml]
type: testharness
[beforeBegin content without next sibling]
expected: FAIL
[afterend content without next sibling]
expected: FAIL
[beforeBegin content again, with next sibling]
expected: FAIL
[afterend content again, with next sibling]
expected: FAIL
[beforeBegin child node not in tree but has parent]
expected: FAIL
[afterend child node not in tree but has parent]
expected: FAIL
[beforeBegin content2 without next sibling]
expected: FAIL
[afterend content2 without next sibling]
expected: FAIL
[beforeBegin content2 test again, now that there's a next sibling]
expected: FAIL
[afterend content2 test again, now that there's a next sibling]
expected: FAIL
[insertAdjacentHTML in HTML]
expected: FAIL