Index: client/html/src/XMLElementWrappingImplementation.dart |
diff --git a/client/html/src/XMLElementWrappingImplementation.dart b/client/html/src/XMLElementWrappingImplementation.dart |
index 94aa3536961701e73ba25a98749bfc2b1dd23015..161cdbf7c5e11b4cca5ad0c6aecd4bf1d5ca0659 100644 |
--- a/client/html/src/XMLElementWrappingImplementation.dart |
+++ b/client/html/src/XMLElementWrappingImplementation.dart |
@@ -52,19 +52,25 @@ class XMLElementWrappingImplementation extends ElementWrappingImplementation |
String get outerHTML() { |
final container = new Element.tag("div"); |
- container.elements.add(this.clone(true)); |
+ // Safari requires that the clone be removed from its owner document before |
+ // being inserted into the HTML document. |
+ container.elements.add(this.clone(true).remove()); |
return container.innerHTML; |
} |
String get innerHTML() { |
final container = new Element.tag("div"); |
- container.nodes.addAll(this.clone(true).nodes); |
+ // Safari requires that the clone be removed from its owner document before |
+ // being inserted into the HTML document. |
+ container.nodes.addAll(this.clone(true).remove().nodes); |
return container.innerHTML; |
} |
void set innerHTML(String xml) { |
final xmlDoc = new XMLDocument.xml('<xml>$xml</xml>'); |
- this.nodes = xmlDoc.nodes; |
+ // Safari requires that the root node be removed from the document before |
+ // being inserted into the HTML document. |
+ this.nodes = xmlDoc.remove().nodes; |
} |
Node _insertAdjacentNode(String where, Node node) { |