OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 part of $LIBRARYNAME; | 5 part of $LIBRARYNAME; |
6 | 6 |
7 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
{ | 7 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
{ |
8 factory $CLASSNAME() => document.createDocumentFragment(); | 8 factory $CLASSNAME() => document.createDocumentFragment(); |
9 | 9 |
10 factory $CLASSNAME.html(String html, | 10 factory $CLASSNAME.html(String html, |
(...skipping 20 matching lines...) Expand all Loading... |
31 $endif | 31 $endif |
32 List<Element> _docChildren; | 32 List<Element> _docChildren; |
33 | 33 |
34 List<Element> get children { | 34 List<Element> get children { |
35 if (_docChildren == null) { | 35 if (_docChildren == null) { |
36 _docChildren = new FilteredElementList(this); | 36 _docChildren = new FilteredElementList(this); |
37 } | 37 } |
38 return _docChildren; | 38 return _docChildren; |
39 } | 39 } |
40 | 40 |
41 set children(List<Element> value) { | 41 void set children(List<Element> value) { |
42 // Copy list first since we don't want liveness during iteration. | 42 // Copy list first since we don't want liveness during iteration. |
43 List copy = new List.from(value); | 43 List copy = new List.from(value); |
44 var children = this.children; | 44 var children = this.children; |
45 children.clear(); | 45 children.clear(); |
46 children.addAll(copy); | 46 children.addAll(copy); |
47 } | 47 } |
48 | 48 |
49 /** | 49 /** |
50 * Finds all descendant elements of this document fragment that match the | 50 * Finds all descendant elements of this document fragment that match the |
51 * specified group of selectors. | 51 * specified group of selectors. |
52 * | 52 * |
53 * [selectors] should be a string using CSS selector syntax. | 53 * [selectors] should be a string using CSS selector syntax. |
54 * | 54 * |
55 * var items = document.querySelectorAll('.itemClassName'); | 55 * var items = document.querySelectorAll('.itemClassName'); |
56 * | 56 * |
57 * For details about CSS selector syntax, see the | 57 * For details about CSS selector syntax, see the |
58 * [CSS selector specification](http://www.w3.org/TR/css3-selectors/). | 58 * [CSS selector specification](http://www.w3.org/TR/css3-selectors/). |
59 */ | 59 */ |
60 ElementList<Element> querySelectorAll(String selectors) => | 60 ElementList<Element> querySelectorAll(String selectors) => |
| 61 $if JSINTEROP |
| 62 _querySelectorAll(selectors); |
| 63 $else |
61 new _FrozenElementList._wrap(_querySelectorAll(selectors)); | 64 new _FrozenElementList._wrap(_querySelectorAll(selectors)); |
| 65 $endif |
| 66 |
62 | 67 |
63 String get innerHtml { | 68 String get innerHtml { |
64 final e = new Element.tag("div"); | 69 final e = new Element.tag("div"); |
65 e.append(this.clone(true)); | 70 e.append(this.clone(true)); |
66 return e.innerHtml; | 71 return e.innerHtml; |
67 } | 72 } |
68 | 73 |
69 set innerHtml(String value) { | 74 void set innerHtml(String value) { |
70 this.setInnerHtml(value); | 75 this.setInnerHtml(value); |
71 } | 76 } |
72 | 77 |
73 void setInnerHtml(String html, | 78 void setInnerHtml(String html, |
74 {NodeValidator validator, NodeTreeSanitizer treeSanitizer}) { | 79 {NodeValidator validator, NodeTreeSanitizer treeSanitizer}) { |
75 | 80 |
76 this.nodes.clear(); | 81 this.nodes.clear(); |
77 append(document.body.createFragment( | 82 append(document.body.createFragment( |
78 html, validator: validator, treeSanitizer: treeSanitizer)); | 83 html, validator: validator, treeSanitizer: treeSanitizer)); |
79 } | 84 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 * semantics will be changing in the future. | 118 * semantics will be changing in the future. |
114 */ | 119 */ |
115 @deprecated | 120 @deprecated |
116 @Experimental() | 121 @Experimental() |
117 @DomName('DocumentFragment.querySelectorAll') | 122 @DomName('DocumentFragment.querySelectorAll') |
118 ElementList<Element> queryAll(String relativeSelectors) { | 123 ElementList<Element> queryAll(String relativeSelectors) { |
119 return querySelectorAll(relativeSelectors); | 124 return querySelectorAll(relativeSelectors); |
120 } | 125 } |
121 $!MEMBERS | 126 $!MEMBERS |
122 } | 127 } |
OLD | NEW |