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

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

Issue 23567006: Revert "Basic functionality is working with JS native support and polyfill, still some issues with … (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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 * var myElement = new Element.tag('unknownTag'); 347 * var myElement = new Element.tag('unknownTag');
348 * print(myElement is UnknownElement); // 'true' 348 * print(myElement is UnknownElement); // 'true'
349 * 349 *
350 * For standard elements it is more preferable to use the type constructors: 350 * For standard elements it is more preferable to use the type constructors:
351 * var element = new DivElement(); 351 * var element = new DivElement();
352 * 352 *
353 * See also: 353 * See also:
354 * 354 *
355 * * [isTagSupported] 355 * * [isTagSupported]
356 */ 356 */
357 factory $CLASSNAME.tag(String tag, [String typeExtention]) => 357 factory $CLASSNAME.tag(String tag) =>
358 _$(CLASSNAME)FactoryProvider.createElement_tag(tag, typeExtention); 358 _$(CLASSNAME)FactoryProvider.createElement_tag(tag);
359 359
360 /// Creates a new `<a>` element. 360 /// Creates a new `<a>` element.
361 /// 361 ///
362 /// This is identical to calling `new Element.tag('a')`. 362 /// This is identical to calling `new Element.tag('a')`.
363 factory Element.a() => new Element.tag('a'); 363 factory Element.a() => new Element.tag('a');
364 364
365 /// Creates a new `<article>` element. 365 /// Creates a new `<article>` element.
366 /// 366 ///
367 /// This is identical to calling `new Element.tag('article')`. 367 /// This is identical to calling `new Element.tag('article')`.
368 factory Element.article() => new Element.tag('article'); 368 factory Element.article() => new Element.tag('article');
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 void appendHtml(String text) { 665 void appendHtml(String text) {
666 this.insertAdjacentHtml('beforeend', text); 666 this.insertAdjacentHtml('beforeend', text);
667 } 667 }
668 668
669 /** 669 /**
670 * Checks to see if the tag name is supported by the current platform. 670 * Checks to see if the tag name is supported by the current platform.
671 * 671 *
672 * The tag should be a valid HTML tag name. 672 * The tag should be a valid HTML tag name.
673 */ 673 */
674 static bool isTagSupported(String tag) { 674 static bool isTagSupported(String tag) {
675 var e = _ElementFactoryProvider.createElement_tag(tag, null); 675 var e = _ElementFactoryProvider.createElement_tag(tag);
676 return e is Element && !(e is UnknownElement); 676 return e is Element && !(e is UnknownElement);
677 } 677 }
678 678
679 /** 679 /**
680 * Called by the DOM when this element has been instantiated. 680 * Called by the DOM when this element has been instantiated.
681 */ 681 */
682 @Experimental() 682 @Experimental()
683 void created() {} 683 void created() {}
684 684
685 // Hooks to support custom WebComponents. 685 // Hooks to support custom WebComponents.
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 $!MEMBERS 1308 $!MEMBERS
1309 } 1309 }
1310 1310
1311 1311
1312 class _ElementFactoryProvider { 1312 class _ElementFactoryProvider {
1313 1313
1314 @DomName('Document.createElement') 1314 @DomName('Document.createElement')
1315 $if DART2JS 1315 $if DART2JS
1316 // Optimization to improve performance until the dart2js compiler inlines this 1316 // Optimization to improve performance until the dart2js compiler inlines this
1317 // method. 1317 // method.
1318 static dynamic createElement_tag(String tag, String typeExtension) { 1318 static dynamic createElement_tag(String tag) =>
1319 // Firefox may return a JS function for some types (Embed, Object). 1319 // Firefox may return a JS function for some types (Embed, Object).
1320 if (typeExtension != null) { 1320 JS('Element|=Object', 'document.createElement(#)', tag);
1321 return JS('Element|=Object', 'document.createElement(#, #)',
1322 tag, typeExtension);
1323 }
1324 // Should be able to eliminate this and just call the two-arg version above
1325 // with null typeExtension, but Chrome treats the tag as case-sensitive if
1326 // typeExtension is null.
1327 // https://code.google.com/p/chromium/issues/detail?id=282467
1328 return JS('Element|=Object', 'document.createElement(#)', tag);
1329 }
1330
1331 $else 1321 $else
1332 static Element createElement_tag(String tag, String typeExtension) => 1322 static Element createElement_tag(String tag) =>
1333 document.$dom_createElement(tag, typeExtension); 1323 document.$dom_createElement(tag);
1334 $endif 1324 $endif
1335 } 1325 }
1336 1326
1337 1327
1338 /** 1328 /**
1339 * Options for Element.scrollIntoView. 1329 * Options for Element.scrollIntoView.
1340 */ 1330 */
1341 class ScrollAlignment { 1331 class ScrollAlignment {
1342 final _value; 1332 final _value;
1343 const ScrollAlignment._internal(this._value); 1333 const ScrollAlignment._internal(this._value);
1344 toString() => 'ScrollAlignment.$_value'; 1334 toString() => 'ScrollAlignment.$_value';
1345 1335
1346 /// Attempt to align the element to the top of the scrollable area. 1336 /// Attempt to align the element to the top of the scrollable area.
1347 static const TOP = const ScrollAlignment._internal('TOP'); 1337 static const TOP = const ScrollAlignment._internal('TOP');
1348 /// Attempt to center the element in the scrollable area. 1338 /// Attempt to center the element in the scrollable area.
1349 static const CENTER = const ScrollAlignment._internal('CENTER'); 1339 static const CENTER = const ScrollAlignment._internal('CENTER');
1350 /// Attempt to align the element to the bottom of the scrollable area. 1340 /// Attempt to align the element to the bottom of the scrollable area.
1351 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); 1341 static const BOTTOM = const ScrollAlignment._internal('BOTTOM');
1352 } 1342 }
OLDNEW
« no previous file with comments | « tools/dom/src/dart2js_CustomElementSupport.dart ('k') | tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698