OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library template_element_test; | 5 library template_element_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 import 'dart:html'; | 9 import 'dart:html'; |
10 import 'dart:math' as math; | 10 import 'dart:math' as math; |
(...skipping 22 matching lines...) Expand all Loading... |
33 document.body.append(testDiv = new DivElement()); | 33 document.body.append(testDiv = new DivElement()); |
34 }); | 34 }); |
35 | 35 |
36 tearDown(() { | 36 tearDown(() { |
37 testDiv.remove(); | 37 testDiv.remove(); |
38 testDiv = null; | 38 testDiv = null; |
39 }); | 39 }); |
40 | 40 |
41 createTestHtml(s) { | 41 createTestHtml(s) { |
42 var div = new DivElement(); | 42 var div = new DivElement(); |
43 div.innerHtml = s; | 43 div.setInnerHtml(s, treeSanitizer: new NullTreeSanitizer()); |
44 testDiv.append(div); | 44 testDiv.append(div); |
45 | 45 |
46 for (var node in div.queryAll('*')) { | 46 for (var node in div.queryAll('*')) { |
47 if (node.isTemplate) TemplateElement.decorate(node); | 47 if (node.isTemplate) TemplateElement.decorate(node); |
48 } | 48 } |
49 | 49 |
50 return div; | 50 return div; |
51 } | 51 } |
52 | 52 |
53 createShadowTestHtml(s) { | 53 createShadowTestHtml(s) { |
(...skipping 1718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1772 k = k is String ? sym(k) : _deepToSymbol(k); | 1772 k = k is String ? sym(k) : _deepToSymbol(k); |
1773 result[k] = _deepToSymbol(v); | 1773 result[k] = _deepToSymbol(v); |
1774 }); | 1774 }); |
1775 return result; | 1775 return result; |
1776 } | 1776 } |
1777 if (value is Iterable) { | 1777 if (value is Iterable) { |
1778 return value.map(_deepToSymbol).toList(); | 1778 return value.map(_deepToSymbol).toList(); |
1779 } | 1779 } |
1780 return value; | 1780 return value; |
1781 } | 1781 } |
| 1782 |
| 1783 /** |
| 1784 * Sanitizer which does nothing. |
| 1785 */ |
| 1786 class NullTreeSanitizer implements NodeTreeSanitizer { |
| 1787 void sanitizeTree(Node node) {} |
| 1788 } |
OLD | NEW |