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)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { | 7 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
8 factory $CLASSNAME() => document.createDocumentFragment(); | 8 factory $CLASSNAME() => document.createDocumentFragment(); |
9 | 9 |
10 factory $CLASSNAME.html(String html, | 10 factory $CLASSNAME.html(String html, |
11 {NodeValidator validator, NodeTreeSanitizer treeSanitizer}) { | 11 {NodeValidator validator, NodeTreeSanitizer treeSanitizer}) { |
12 | 12 |
13 return document.body.createFragment(html, | 13 return document.body.createFragment(html, |
14 validator: validator, treeSanitizer: treeSanitizer); | 14 validator: validator, treeSanitizer: treeSanitizer); |
15 } | 15 } |
16 | 16 |
17 factory $CLASSNAME.svg(String svgContent, | 17 factory $CLASSNAME.svg(String svgContent, |
18 {NodeValidator validator, NodeTreeSanitizer treeSanitizer}) { | 18 {NodeValidator validator, NodeTreeSanitizer treeSanitizer}) { |
19 | 19 |
20 return new svg.SvgSvgElement().createFragment(svgContent, | 20 return new svg.SvgSvgElement().createFragment(svgContent, |
21 validator: validator, treeSanitizer: treeSanitizer); | 21 validator: validator, treeSanitizer: treeSanitizer); |
22 } | 22 } |
23 | 23 |
24 HtmlCollection get _children => throw new UnimplementedError( | |
25 'Use _docChildren instead'); | |
26 | |
27 $if DART2JS | 24 $if DART2JS |
28 // Native field is used only by Dart code so does not lead to instantiation | 25 // Native field is used only by Dart code so does not lead to instantiation |
29 // of native classes | 26 // of native classes |
30 @Creates('Null') | 27 @Creates('Null') |
31 $endif | 28 $endif |
32 List<Element> _docChildren; | 29 List<Element> _children; |
33 | 30 |
34 List<Element> get children { | 31 List<Element> get children { |
35 if (_docChildren == null) { | 32 if (_children == null) { |
36 _docChildren = new FilteredElementList(this); | 33 _children = new FilteredElementList(this); |
37 } | 34 } |
38 return _docChildren; | 35 return _children; |
39 } | 36 } |
40 | 37 |
41 void set children(List<Element> value) { | 38 void set children(List<Element> value) { |
42 // Copy list first since we don't want liveness during iteration. | 39 // Copy list first since we don't want liveness during iteration. |
43 List copy = new List.from(value); | 40 List copy = new List.from(value); |
44 var children = this.children; | 41 var children = this.children; |
45 children.clear(); | 42 children.clear(); |
46 children.addAll(copy); | 43 children.addAll(copy); |
47 } | 44 } |
48 | 45 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 * semantics will be changing in the future. | 110 * semantics will be changing in the future. |
114 */ | 111 */ |
115 @deprecated | 112 @deprecated |
116 @Experimental() | 113 @Experimental() |
117 @DomName('DocumentFragment.querySelectorAll') | 114 @DomName('DocumentFragment.querySelectorAll') |
118 ElementList queryAll(String relativeSelectors) { | 115 ElementList queryAll(String relativeSelectors) { |
119 return querySelectorAll(relativeSelectors); | 116 return querySelectorAll(relativeSelectors); |
120 } | 117 } |
121 $!MEMBERS | 118 $!MEMBERS |
122 } | 119 } |
OLD | NEW |