| 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 $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { | 7 $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
| 8 factory $CLASSNAME() => _$(CLASSNAME)FactoryProvider.createDocumentFragment(); | 8 factory $CLASSNAME() => _$(CLASSNAME)FactoryProvider.createDocumentFragment(); |
| 9 | 9 |
| 10 factory $CLASSNAME.html(String html) => | 10 factory $CLASSNAME.html(String html) => |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 // TODO(nweiz): Do we want to support some variant of innerHtml for XML and/or | 49 // TODO(nweiz): Do we want to support some variant of innerHtml for XML and/or |
| 50 // SVG strings? | 50 // SVG strings? |
| 51 void set innerHtml(String value) { | 51 void set innerHtml(String value) { |
| 52 this.nodes.clear(); | 52 this.nodes.clear(); |
| 53 | 53 |
| 54 final e = new Element.tag("div"); | 54 final e = new Element.tag("div"); |
| 55 e.innerHtml = value; | 55 e.innerHtml = value; |
| 56 | 56 |
| 57 // Copy list first since we don't want liveness during iteration. | 57 // Copy list first since we don't want liveness during iteration. |
| 58 List nodes = new List.from(e.nodes); | 58 List nodes = new List.from(e.nodes, growable: false); |
| 59 this.nodes.addAll(nodes); | 59 this.nodes.addAll(nodes); |
| 60 } | 60 } |
| 61 | 61 |
| 62 /** | 62 /** |
| 63 * Adds the specified text as a text node after the last child of this | 63 * Adds the specified text as a text node after the last child of this |
| 64 * document fragment. | 64 * document fragment. |
| 65 */ | 65 */ |
| 66 void appendText(String text) { | 66 void appendText(String text) { |
| 67 this.append(new Text(text)); | 67 this.append(new Text(text)); |
| 68 } | 68 } |
| 69 | 69 |
| 70 | 70 |
| 71 /** | 71 /** |
| 72 * Parses the specified text as HTML and adds the resulting node after the | 72 * Parses the specified text as HTML and adds the resulting node after the |
| 73 * last child of this document fragment. | 73 * last child of this document fragment. |
| 74 */ | 74 */ |
| 75 void appendHtml(String text) { | 75 void appendHtml(String text) { |
| 76 this.append(new DocumentFragment.html(text)); | 76 this.append(new DocumentFragment.html(text)); |
| 77 } | 77 } |
| 78 | 78 |
| 79 $!MEMBERS | 79 $!MEMBERS |
| 80 } | 80 } |
| OLD | NEW |