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 { | |
8 static CustomEvent createCustomEvent(String type, [bool canBubble = true, | |
9 bool cancelable = true, Object detail = null]) { | |
10 final CustomEvent e = document.$dom_createEvent("CustomEvent"); | |
11 e.$dom_initCustomEvent(type, canBubble, cancelable, detail); | |
12 return e; | |
13 } | |
14 } | |
15 | |
16 class _EventFactoryProvider { | |
17 static Event createEvent(String type, [bool canBubble = true, | |
18 bool cancelable = true]) { | |
19 final Event e = document.$dom_createEvent("Event"); | |
20 e.$dom_initEvent(type, canBubble, cancelable); | |
21 return e; | |
22 } | |
23 } | |
24 | |
25 class _MouseEventFactoryProvider { | |
26 static MouseEvent createMouseEvent(String type, Window view, int detail, | |
27 int screenX, int screenY, int clientX, int clientY, int button, | |
28 [bool canBubble = true, bool cancelable = true, bool ctrlKey = false, | |
29 bool altKey = false, bool shiftKey = false, bool metaKey = false, | |
30 EventTarget relatedTarget = null]) { | |
31 final e = document.$dom_createEvent("MouseEvent"); | |
32 e.$dom_initMouseEvent(type, canBubble, cancelable, view, detail, | |
33 screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, | |
34 button, relatedTarget); | |
35 return e; | |
36 } | |
37 } | |
38 | |
39 class _CssStyleDeclarationFactoryProvider { | 7 class _CssStyleDeclarationFactoryProvider { |
40 static CssStyleDeclaration createCssStyleDeclaration_css(String css) { | 8 static CssStyleDeclaration createCssStyleDeclaration_css(String css) { |
41 final style = new Element.tag('div').style; | 9 final style = new Element.tag('div').style; |
42 style.cssText = css; | 10 style.cssText = css; |
43 return style; | 11 return style; |
44 } | 12 } |
45 | 13 |
46 static CssStyleDeclaration createCssStyleDeclaration() { | 14 static CssStyleDeclaration createCssStyleDeclaration() { |
47 return new CssStyleDeclaration.css(''); | 15 return new CssStyleDeclaration.css(''); |
48 } | 16 } |
(...skipping 26 matching lines...) Expand all Loading... |
75 final fragment = new DocumentFragment(); | 43 final fragment = new DocumentFragment(); |
76 final e = new svg.SvgSvgElement(); | 44 final e = new svg.SvgSvgElement(); |
77 e.innerHtml = svgContent; | 45 e.innerHtml = svgContent; |
78 | 46 |
79 // Copy list first since we don't want liveness during iteration. | 47 // Copy list first since we don't want liveness during iteration. |
80 final List nodes = new List.from(e.nodes); | 48 final List nodes = new List.from(e.nodes); |
81 fragment.nodes.addAll(nodes); | 49 fragment.nodes.addAll(nodes); |
82 return fragment; | 50 return fragment; |
83 } | 51 } |
84 } | 52 } |
OLD | NEW |