| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
| 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. | |
| 4 | |
| 5 part of html; | |
| 6 | |
| 7 class _CssStyleDeclarationFactoryProvider { | |
| 8 static CssStyleDeclaration createCssStyleDeclaration_css(String css) { | |
| 9 final style = new Element.tag('div').style; | |
| 10 style.cssText = css; | |
| 11 return style; | |
| 12 } | |
| 13 | |
| 14 static CssStyleDeclaration createCssStyleDeclaration() { | |
| 15 return new CssStyleDeclaration.css(''); | |
| 16 } | |
| 17 } | |
| 18 | |
| 19 class _DocumentFragmentFactoryProvider { | |
| 20 @DomName('Document.createDocumentFragment') | |
| 21 static DocumentFragment createDocumentFragment() => | |
| 22 document.createDocumentFragment(); | |
| 23 | |
| 24 static DocumentFragment createDocumentFragment_html(String html) { | |
| 25 final fragment = new DocumentFragment(); | |
| 26 fragment.innerHtml = html; | |
| 27 return fragment; | |
| 28 } | |
| 29 | |
| 30 // TODO(nweiz): enable this when XML is ported. | |
| 31 // factory DocumentFragment.xml(String xml) { | |
| 32 // final fragment = new DocumentFragment(); | |
| 33 // final e = new XMLElement.tag("xml"); | |
| 34 // e.innerHtml = xml; | |
| 35 // | |
| 36 // // Copy list first since we don't want liveness during iteration. | |
| 37 // final List nodes = new List.from(e.nodes); | |
| 38 // fragment.nodes.addAll(nodes); | |
| 39 // return fragment; | |
| 40 // } | |
| 41 | |
| 42 static DocumentFragment createDocumentFragment_svg(String svgContent) { | |
| 43 final fragment = new DocumentFragment(); | |
| 44 final e = new svg.SvgSvgElement(); | |
| 45 e.innerHtml = svgContent; | |
| 46 | |
| 47 // Copy list first since we don't want liveness during iteration. | |
| 48 final List nodes = new List.from(e.nodes); | |
| 49 fragment.nodes.addAll(nodes); | |
| 50 return fragment; | |
| 51 } | |
| 52 } | |
| OLD | NEW |