| 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.html(String html) => | 8 factory $CLASSNAME() => document.createDocumentFragment(); |
| 9 _$(CLASSNAME)FactoryProvider.createDocumentFragment_html(html); | |
| 10 | 9 |
| 11 factory $CLASSNAME.svg(String svgContent) => | 10 factory $CLASSNAME.html(String html) { |
| 12 _$(CLASSNAME)FactoryProvider.createDocumentFragment_svg(svgContent); | 11 final fragment = new DocumentFragment(); |
| 12 fragment.innerHtml = html; |
| 13 return fragment; |
| 14 } |
| 15 |
| 16 factory $CLASSNAME.svg(String svgContent) { |
| 17 final fragment = new DocumentFragment(); |
| 18 final e = new svg.SvgSvgElement(); |
| 19 e.innerHtml = svgContent; |
| 20 |
| 21 // Copy list first since we don't want liveness during iteration. |
| 22 final List nodes = new List.from(e.nodes); |
| 23 fragment.nodes.addAll(nodes); |
| 24 return fragment; |
| 25 } |
| 13 | 26 |
| 14 $if DART2JS | 27 $if DART2JS |
| 15 // Native field is used only by Dart code so does not lead to instantiation | 28 // Native field is used only by Dart code so does not lead to instantiation |
| 16 // of native classes | 29 // of native classes |
| 17 @Creates('Null') | 30 @Creates('Null') |
| 18 $endif | 31 $endif |
| 19 List<Element> _children; | 32 List<Element> _children; |
| 20 | 33 |
| 21 List<Element> get children { | 34 List<Element> get children { |
| 22 if (_children == null) { | 35 if (_children == null) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 /** | 82 /** |
| 70 * Parses the specified text as HTML and adds the resulting node after the | 83 * Parses the specified text as HTML and adds the resulting node after the |
| 71 * last child of this document fragment. | 84 * last child of this document fragment. |
| 72 */ | 85 */ |
| 73 void appendHtml(String text) { | 86 void appendHtml(String text) { |
| 74 this.append(new DocumentFragment.html(text)); | 87 this.append(new DocumentFragment.html(text)); |
| 75 } | 88 } |
| 76 | 89 |
| 77 $!MEMBERS | 90 $!MEMBERS |
| 78 } | 91 } |
| OLD | NEW |