| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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 html; | 5 part of html; |
| 6 | 6 |
| 7 class _CustomEventFactoryProvider { | 7 class _CustomEventFactoryProvider { |
| 8 static CustomEvent createCustomEvent(String type, [bool canBubble = true, | 8 static CustomEvent createCustomEvent(String type, [bool canBubble = true, |
| 9 bool cancelable = true, Object detail = null]) { | 9 bool cancelable = true, Object detail = null]) { |
| 10 final CustomEvent e = document.$dom_createEvent("CustomEvent"); | 10 final CustomEvent e = document.$dom_createEvent("CustomEvent"); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 bool altKey = false, bool shiftKey = false, bool metaKey = false, | 29 bool altKey = false, bool shiftKey = false, bool metaKey = false, |
| 30 EventTarget relatedTarget = null]) { | 30 EventTarget relatedTarget = null]) { |
| 31 final e = document.$dom_createEvent("MouseEvent"); | 31 final e = document.$dom_createEvent("MouseEvent"); |
| 32 e.$dom_initMouseEvent(type, canBubble, cancelable, view, detail, | 32 e.$dom_initMouseEvent(type, canBubble, cancelable, view, detail, |
| 33 screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, | 33 screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, |
| 34 button, relatedTarget); | 34 button, relatedTarget); |
| 35 return e; | 35 return e; |
| 36 } | 36 } |
| 37 } | 37 } |
| 38 | 38 |
| 39 class _CSSStyleDeclarationFactoryProvider { | 39 class _CssStyleDeclarationFactoryProvider { |
| 40 static CSSStyleDeclaration createCSSStyleDeclaration_css(String css) { | 40 static CssStyleDeclaration createCssStyleDeclaration_css(String css) { |
| 41 final style = new Element.tag('div').style; | 41 final style = new Element.tag('div').style; |
| 42 style.cssText = css; | 42 style.cssText = css; |
| 43 return style; | 43 return style; |
| 44 } | 44 } |
| 45 | 45 |
| 46 static CSSStyleDeclaration createCSSStyleDeclaration() { | 46 static CssStyleDeclaration createCssStyleDeclaration() { |
| 47 return new CSSStyleDeclaration.css(''); | 47 return new CssStyleDeclaration.css(''); |
| 48 } | 48 } |
| 49 } | 49 } |
| 50 | 50 |
| 51 class _DocumentFragmentFactoryProvider { | 51 class _DocumentFragmentFactoryProvider { |
| 52 /** @domName Document.createDocumentFragment */ | 52 /** @domName Document.createDocumentFragment */ |
| 53 static DocumentFragment createDocumentFragment() => | 53 static DocumentFragment createDocumentFragment() => |
| 54 document.createDocumentFragment(); | 54 document.createDocumentFragment(); |
| 55 | 55 |
| 56 static DocumentFragment createDocumentFragment_html(String html) { | 56 static DocumentFragment createDocumentFragment_html(String html) { |
| 57 final fragment = new DocumentFragment(); | 57 final fragment = new DocumentFragment(); |
| 58 fragment.innerHtml = html; | 58 fragment.innerHtml = html; |
| 59 return fragment; | 59 return fragment; |
| 60 } | 60 } |
| 61 | 61 |
| 62 // TODO(nweiz): enable this when XML is ported. | 62 // TODO(nweiz): enable this when XML is ported. |
| 63 // factory DocumentFragment.xml(String xml) { | 63 // factory DocumentFragment.xml(String xml) { |
| 64 // final fragment = new DocumentFragment(); | 64 // final fragment = new DocumentFragment(); |
| 65 // final e = new XMLElement.tag("xml"); | 65 // final e = new XMLElement.tag("xml"); |
| 66 // e.innerHtml = xml; | 66 // e.innerHtml = xml; |
| 67 // | 67 // |
| 68 // // Copy list first since we don't want liveness during iteration. | 68 // // Copy list first since we don't want liveness during iteration. |
| 69 // final List nodes = new List.from(e.nodes); | 69 // final List nodes = new List.from(e.nodes); |
| 70 // fragment.nodes.addAll(nodes); | 70 // fragment.nodes.addAll(nodes); |
| 71 // return fragment; | 71 // return fragment; |
| 72 // } | 72 // } |
| 73 | 73 |
| 74 static DocumentFragment createDocumentFragment_svg(String svgContent) { | 74 static DocumentFragment createDocumentFragment_svg(String svgContent) { |
| 75 final fragment = new DocumentFragment(); | 75 final fragment = new DocumentFragment(); |
| 76 final e = new svg.SVGSVGElement(); | 76 final e = new svg.SvgSvgElement(); |
| 77 e.innerHtml = svgContent; | 77 e.innerHtml = svgContent; |
| 78 | 78 |
| 79 // Copy list first since we don't want liveness during iteration. | 79 // Copy list first since we don't want liveness during iteration. |
| 80 final List nodes = new List.from(e.nodes); | 80 final List nodes = new List.from(e.nodes); |
| 81 fragment.nodes.addAll(nodes); | 81 fragment.nodes.addAll(nodes); |
| 82 return fragment; | 82 return fragment; |
| 83 } | 83 } |
| 84 } | 84 } |
| OLD | NEW |