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

Side by Side Diff: tools/dom/templates/html/impl/impl_Element.darttemplate

Issue 24084004: Exposing document.createElement (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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
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 part of $LIBRARYNAME; 5 part of $LIBRARYNAME;
6 6
7 class _ChildrenElementList extends ListBase<Element> { 7 class _ChildrenElementList extends ListBase<Element> {
8 // Raw Element. 8 // Raw Element.
9 final Element _element; 9 final Element _element;
10 final HtmlCollection _childElements; 10 final HtmlCollection _childElements;
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 } else if (validator != null) { 1231 } else if (validator != null) {
1232 throw new ArgumentError( 1232 throw new ArgumentError(
1233 'validator can only be passed if treeSanitizer is null'); 1233 'validator can only be passed if treeSanitizer is null');
1234 } 1234 }
1235 1235
1236 if (_parseDocument == null) { 1236 if (_parseDocument == null) {
1237 _parseDocument = document.implementation.createHtmlDocument(''); 1237 _parseDocument = document.implementation.createHtmlDocument('');
1238 _parseRange = _parseDocument.createRange(); 1238 _parseRange = _parseDocument.createRange();
1239 1239
1240 // Workaround for Chrome bug 229142- URIs are not resolved in new doc. 1240 // Workaround for Chrome bug 229142- URIs are not resolved in new doc.
1241 var base = _parseDocument.$dom_createElement('base'); 1241 var base = _parseDocument.createElement('base');
1242 base.href = document._baseUri; 1242 base.href = document._baseUri;
1243 _parseDocument.head.append(base); 1243 _parseDocument.head.append(base);
1244 } 1244 }
1245 var contextElement; 1245 var contextElement;
1246 if (this is BodyElement) { 1246 if (this is BodyElement) {
1247 contextElement = _parseDocument.body; 1247 contextElement = _parseDocument.body;
1248 } else { 1248 } else {
1249 contextElement = _parseDocument.$dom_createElement(tagName); 1249 contextElement = _parseDocument.createElement(tagName);
1250 _parseDocument.body.append(contextElement); 1250 _parseDocument.body.append(contextElement);
1251 } 1251 }
1252 var fragment; 1252 var fragment;
1253 if (Range.supportsCreateContextualFragment) { 1253 if (Range.supportsCreateContextualFragment) {
1254 _parseRange.selectNodeContents(contextElement); 1254 _parseRange.selectNodeContents(contextElement);
1255 fragment = _parseRange.createContextualFragment(html); 1255 fragment = _parseRange.createContextualFragment(html);
1256 } else { 1256 } else {
1257 contextElement._innerHtml = html; 1257 contextElement._innerHtml = html;
1258 1258
1259 fragment = _parseDocument.createDocumentFragment(); 1259 fragment = _parseDocument.createDocumentFragment();
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1335 } 1335 }
1336 // Should be able to eliminate this and just call the two-arg version above 1336 // Should be able to eliminate this and just call the two-arg version above
1337 // with null typeExtension, but Chrome treats the tag as case-sensitive if 1337 // with null typeExtension, but Chrome treats the tag as case-sensitive if
1338 // typeExtension is null. 1338 // typeExtension is null.
1339 // https://code.google.com/p/chromium/issues/detail?id=282467 1339 // https://code.google.com/p/chromium/issues/detail?id=282467
1340 return JS('Element|=Object', 'document.createElement(#)', tag); 1340 return JS('Element|=Object', 'document.createElement(#)', tag);
1341 } 1341 }
1342 1342
1343 $else 1343 $else
1344 static Element createElement_tag(String tag, String typeExtension) => 1344 static Element createElement_tag(String tag, String typeExtension) =>
1345 document.$dom_createElement(tag, typeExtension); 1345 document.createElement(tag, typeExtension);
1346 $endif 1346 $endif
1347 } 1347 }
1348 1348
1349 1349
1350 /** 1350 /**
1351 * Options for Element.scrollIntoView. 1351 * Options for Element.scrollIntoView.
1352 */ 1352 */
1353 class ScrollAlignment { 1353 class ScrollAlignment {
1354 final _value; 1354 final _value;
1355 const ScrollAlignment._internal(this._value); 1355 const ScrollAlignment._internal(this._value);
1356 toString() => 'ScrollAlignment.$_value'; 1356 toString() => 'ScrollAlignment.$_value';
1357 1357
1358 /// Attempt to align the element to the top of the scrollable area. 1358 /// Attempt to align the element to the top of the scrollable area.
1359 static const TOP = const ScrollAlignment._internal('TOP'); 1359 static const TOP = const ScrollAlignment._internal('TOP');
1360 /// Attempt to center the element in the scrollable area. 1360 /// Attempt to center the element in the scrollable area.
1361 static const CENTER = const ScrollAlignment._internal('CENTER'); 1361 static const CENTER = const ScrollAlignment._internal('CENTER');
1362 /// Attempt to align the element to the bottom of the scrollable area. 1362 /// Attempt to align the element to the bottom of the scrollable area.
1363 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); 1363 static const BOTTOM = const ScrollAlignment._internal('BOTTOM');
1364 } 1364 }
OLDNEW
« no previous file with comments | « tools/dom/src/shared_SVGFactoryProviders.dart ('k') | tools/dom/templates/html/impl/impl_HTMLInputElement.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698