Partial ShadowRoot implementation of DocumentOrShadowRoot

This commit is contained in:
Fernando Jiménez Moreno 2019-01-21 20:58:52 +01:00
parent 18ae0fcbd6
commit 4304ee28dc
9 changed files with 161 additions and 54 deletions

View file

@ -764,8 +764,11 @@ impl RangeMethods for Range {
// Step 11
let new_offset = new_offset +
if node.type_id() == NodeTypeId::DocumentFragment(DocumentFragmentTypeId::DocumentFragment) ||
node.type_id() == NodeTypeId::DocumentFragment(DocumentFragmentTypeId::ShadowRoot) {
if node.type_id() ==
NodeTypeId::DocumentFragment(DocumentFragmentTypeId::DocumentFragment) ||
node.type_id() ==
NodeTypeId::DocumentFragment(DocumentFragmentTypeId::ShadowRoot)
{
node.len()
} else {
1
@ -880,7 +883,9 @@ impl RangeMethods for Range {
// Step 2.
match new_parent.type_id() {
NodeTypeId::Document(_) | NodeTypeId::DocumentType | NodeTypeId::DocumentFragment(_) => {
NodeTypeId::Document(_) |
NodeTypeId::DocumentType |
NodeTypeId::DocumentFragment(_) => {
return Err(Error::InvalidNodeType);
},
_ => (),