Throw NotSupported when trying to deep clone a shadow root

This commit is contained in:
Fernando Jiménez Moreno 2019-01-29 15:06:34 +01:00
parent d6ddb08e23
commit 6a85409ffe
3 changed files with 18 additions and 13 deletions

View file

@ -500,7 +500,7 @@ impl RangeMethods for Range {
fragment.upcast::<Node>().AppendChild(&clone)?;
} else {
// Step 14.1.
let clone = child.CloneNode(false);
let clone = child.CloneNode(/* deep */ false)?;
// Step 14.2.
fragment.upcast::<Node>().AppendChild(&clone)?;
// Step 14.3.
@ -521,7 +521,7 @@ impl RangeMethods for Range {
// Step 15.
for child in contained_children {
// Step 15.1.
let clone = child.CloneNode(true);
let clone = child.CloneNode(/* deep */ true)?;
// Step 15.2.
fragment.upcast::<Node>().AppendChild(&clone)?;
}
@ -537,7 +537,7 @@ impl RangeMethods for Range {
fragment.upcast::<Node>().AppendChild(&clone)?;
} else {
// Step 17.1.
let clone = child.CloneNode(false);
let clone = child.CloneNode(/* deep */ false)?;
// Step 17.2.
fragment.upcast::<Node>().AppendChild(&clone)?;
// Step 17.3.
@ -573,7 +573,7 @@ impl RangeMethods for Range {
if end_node == start_node {
if let Some(end_data) = end_node.downcast::<CharacterData>() {
// Step 4.1.
let clone = end_node.CloneNode(true);
let clone = end_node.CloneNode(/* deep */ true)?;
// Step 4.2.
let text = end_data.SubstringData(start_offset, end_offset - start_offset);
clone
@ -614,7 +614,7 @@ impl RangeMethods for Range {
if let Some(start_data) = child.downcast::<CharacterData>() {
assert!(child == start_node);
// Step 15.1.
let clone = start_node.CloneNode(true);
let clone = start_node.CloneNode(/* deep */ true)?;
// Step 15.2.
let text = start_data.SubstringData(start_offset, start_node.len() - start_offset);
clone
@ -631,7 +631,7 @@ impl RangeMethods for Range {
)?;
} else {
// Step 16.1.
let clone = child.CloneNode(false);
let clone = child.CloneNode(/* deep */ false)?;
// Step 16.2.
fragment.upcast::<Node>().AppendChild(&clone)?;
// Step 16.3.
@ -658,7 +658,7 @@ impl RangeMethods for Range {
if let Some(end_data) = child.downcast::<CharacterData>() {
assert!(child == end_node);
// Step 18.1.
let clone = end_node.CloneNode(true);
let clone = end_node.CloneNode(/* deep */ true)?;
// Step 18.2.
let text = end_data.SubstringData(0, end_offset);
clone
@ -671,7 +671,7 @@ impl RangeMethods for Range {
end_data.ReplaceData(0, end_offset, DOMString::new())?;
} else {
// Step 19.1.
let clone = child.CloneNode(false);
let clone = child.CloneNode(/* deep */ false)?;
// Step 19.2.
fragment.upcast::<Node>().AppendChild(&clone)?;
// Step 19.3.