Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(426)

Side by Side Diff: client/html/src/XMLElementWrappingImplementation.dart

Issue 9513015: Fix XML tests on Safari and IE. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « client/html/release/htmlimpl.dart ('k') | client/tests/client/client.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 class _XMLClassSet extends _CssClassSet { 5 class _XMLClassSet extends _CssClassSet {
6 _XMLClassSet(element) : super(element); 6 _XMLClassSet(element) : super(element);
7 7
8 String _className() { 8 String _className() {
9 final classStr = _element.getAttribute('class'); 9 final classStr = _element.getAttribute('class');
10 return classStr == null ? '' : classStr; 10 return classStr == null ? '' : classStr;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 // TODO: The type of value should be Collection<Element>. See http://b/5392897 46 // TODO: The type of value should be Collection<Element>. See http://b/5392897
47 void set elements(value) { 47 void set elements(value) {
48 final elements = this.elements; 48 final elements = this.elements;
49 elements.clear(); 49 elements.clear();
50 elements.addAll(value); 50 elements.addAll(value);
51 } 51 }
52 52
53 String get outerHTML() { 53 String get outerHTML() {
54 final container = new Element.tag("div"); 54 final container = new Element.tag("div");
55 container.elements.add(this.clone(true)); 55 // Safari requires that the clone be removed from its owner document before
56 // being inserted into the HTML document.
57 container.elements.add(this.clone(true).remove());
56 return container.innerHTML; 58 return container.innerHTML;
57 } 59 }
58 60
59 String get innerHTML() { 61 String get innerHTML() {
60 final container = new Element.tag("div"); 62 final container = new Element.tag("div");
61 container.nodes.addAll(this.clone(true).nodes); 63 // Safari requires that the clone be removed from its owner document before
64 // being inserted into the HTML document.
65 container.nodes.addAll(this.clone(true).remove().nodes);
62 return container.innerHTML; 66 return container.innerHTML;
63 } 67 }
64 68
65 void set innerHTML(String xml) { 69 void set innerHTML(String xml) {
66 final xmlDoc = new XMLDocument.xml('<xml>$xml</xml>'); 70 final xmlDoc = new XMLDocument.xml('<xml>$xml</xml>');
67 this.nodes = xmlDoc.nodes; 71 // Safari requires that the root node be removed from the document before
72 // being inserted into the HTML document.
73 this.nodes = xmlDoc.remove().nodes;
68 } 74 }
69 75
70 Node _insertAdjacentNode(String where, Node node) { 76 Node _insertAdjacentNode(String where, Node node) {
71 switch (where.toLowerCase()) { 77 switch (where.toLowerCase()) {
72 case "beforebegin": 78 case "beforebegin":
73 if (parent == null) return null; 79 if (parent == null) return null;
74 parent.insertBefore(node, this); 80 parent.insertBefore(node, this);
75 return node; 81 return node;
76 case "afterend": 82 case "afterend":
77 if (parent == null) return null; 83 if (parent == null) return null;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 183
178 void set lang(String value) { attributes['lang'] = value; } 184 void set lang(String value) { attributes['lang'] = value; }
179 185
180 String get dir() => _attr('dir'); 186 String get dir() => _attr('dir');
181 187
182 void set dir(String value) { attributes['dir'] = value; } 188 void set dir(String value) { attributes['dir'] = value; }
183 189
184 String _attr(String name, [String def = '']) => 190 String _attr(String name, [String def = '']) =>
185 attributes.containsKey(name) ? attributes[name] : def; 191 attributes.containsKey(name) ? attributes[name] : def;
186 } 192 }
OLDNEW
« no previous file with comments | « client/html/release/htmlimpl.dart ('k') | client/tests/client/client.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698