Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(340)

Side by Side Diff: client/html/src/shared_FactoryProviders.dart

Issue 9610011: Port DocumentFragment to the new wrapperless DOM. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge with head Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « client/html/release/html.dart ('k') | client/tests/client/html/DocumentFragmentTests.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 class _TextFactoryProvider { 5 class _TextFactoryProvider {
6 6
7 factory Text(String data) => _document._createTextNode(data); 7 factory Text(String data) => _document._createTextNode(data);
8 } 8 }
9 9
10 class _EventFactoryProvider { 10 class _EventFactoryProvider {
(...skipping 14 matching lines...) Expand all
25 final e = _document._createEvent("MouseEvent"); 25 final e = _document._createEvent("MouseEvent");
26 e._initMouseEvent(type, canBubble, cancelable, view, detail, 26 e._initMouseEvent(type, canBubble, cancelable, view, detail,
27 screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, 27 screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey,
28 button, relatedTarget); 28 button, relatedTarget);
29 return e; 29 return e;
30 } 30 }
31 } 31 }
32 32
33 class _CSSStyleDeclarationFactoryProvider { 33 class _CSSStyleDeclarationFactoryProvider {
34 factory CSSStyleDeclaration.css(String css) { 34 factory CSSStyleDeclaration.css(String css) {
35 var style = new Element.tag('div').style; 35 final style = new Element.tag('div').style;
36 style.cssText = css; 36 style.cssText = css;
37 return style; 37 return style;
38 } 38 }
39 39
40 factory CSSStyleDeclaration() { 40 factory CSSStyleDeclaration() {
41 return new CSSStyleDeclaration.css(''); 41 return new CSSStyleDeclaration.css('');
42 } 42 }
43 } 43 }
44 44
45 final _START_TAG_REGEXP = const RegExp('<(\\w+)'); 45 final _START_TAG_REGEXP = const RegExp('<(\\w+)');
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 throw new IllegalArgumentException('HTML had ${temp.elements.length} ' + 90 throw new IllegalArgumentException('HTML had ${temp.elements.length} ' +
91 'top level elements but 1 expected'); 91 'top level elements but 1 expected');
92 } 92 }
93 element.remove(); 93 element.remove();
94 return element; 94 return element;
95 } 95 }
96 96
97 /** @domName Document.createElement */ 97 /** @domName Document.createElement */
98 factory Element.tag(String tag) => _document._createElement(tag); 98 factory Element.tag(String tag) => _document._createElement(tag);
99 } 99 }
100
101 class _DocumentFragmentFactoryProvider {
102 /** @domName Document.createDocumentFragment */
103 factory DocumentFragment() => document.createDocumentFragment();
104
105 factory DocumentFragment.html(String html) {
106 final fragment = new DocumentFragment();
107 fragment.innerHTML = html;
108 return fragment;
109 }
110
111 // TODO(nweiz): enable this when XML is ported.
112 // factory DocumentFragment.xml(String xml) {
113 // final fragment = new DocumentFragment();
114 // final e = new XMLElement.tag("xml");
115 // e.innerHTML = xml;
116 //
117 // // Copy list first since we don't want liveness during iteration.
118 // final List nodes = new List.from(e.nodes);
119 // fragment.nodes.addAll(nodes);
120 // return fragment;
121 // }
122
123 // TODO(nweiz): enable this when SVG is ported.
124 // factory DocumentFragment.svg(String svg) {
125 // final fragment = new DocumentFragment();
126 // final e = new SVGSVGElement();
127 // e.innerHTML = svg;
128 //
129 // // Copy list first since we don't want liveness during iteration.
130 // final List nodes = new List.from(e.nodes);
131 // fragment.nodes.addAll(nodes);
132 // return fragment;
133 // }
134 }
OLDNEW
« no previous file with comments | « client/html/release/html.dart ('k') | client/tests/client/html/DocumentFragmentTests.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698