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

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

Issue 2705213003: Refined types for most HtmlElement factory constructors (Closed)
Patch Set: Created 3 years, 10 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
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 implements NodeListWrapper { 8 implements NodeListWrapper {
9 // Raw Element. 9 // Raw Element.
10 final Element _element; 10 final Element _element;
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 * 395 *
396 * This is similar to [Document.createElement]. 396 * This is similar to [Document.createElement].
397 * [tag] should be a valid HTML tag name. If [tag] is an unknown tag then 397 * [tag] should be a valid HTML tag name. If [tag] is an unknown tag then
398 * this will create an [UnknownElement]. 398 * this will create an [UnknownElement].
399 * 399 *
400 * var divElement = new Element.tag('div'); 400 * var divElement = new Element.tag('div');
401 * print(divElement is DivElement); // 'true' 401 * print(divElement is DivElement); // 'true'
402 * var myElement = new Element.tag('unknownTag'); 402 * var myElement = new Element.tag('unknownTag');
403 * print(myElement is UnknownElement); // 'true' 403 * print(myElement is UnknownElement); // 'true'
404 * 404 *
405 * For standard elements it is more preferable to use the type constructors: 405 * For standard elements it is better to use the element type constructors:
406 *
406 * var element = new DivElement(); 407 * var element = new DivElement();
407 * 408 *
409 * It is better to use e.g `new CanvasElement()` because the type of the
410 * expression is `CanvasElement`, whereas the type of `Element.tag` is the
411 * less specific `Element`.
412 *
408 * See also: 413 * See also:
409 * 414 *
410 * * [isTagSupported] 415 * * [isTagSupported]
411 */ 416 */
412 factory $CLASSNAME.tag(String tag, [String typeExtention]) => 417 factory $CLASSNAME.tag(String tag, [String typeExtention]) =>
413 _$(CLASSNAME)FactoryProvider.createElement_tag(tag, typeExtention); 418 _$(CLASSNAME)FactoryProvider.createElement_tag(tag, typeExtention);
414 419
415 /// Creates a new `<a>` element. 420 /// Creates a new `<a>` element.
416 /// 421 ///
417 /// This is identical to calling `new Element.tag('a')`. 422 /// This is equivalent to calling `new Element.tag('a')`.
418 factory Element.a() => new Element.tag('a'); 423 factory Element.a() => new AnchorElement();
419 424
420 /// Creates a new `<article>` element. 425 /// Creates a new `<article>` element.
421 /// 426 ///
422 /// This is identical to calling `new Element.tag('article')`. 427 /// This is equivalent to calling `new Element.tag('article')`.
423 factory Element.article() => new Element.tag('article'); 428 factory Element.article() => new Element.tag('article');
424 429
425 /// Creates a new `<aside>` element. 430 /// Creates a new `<aside>` element.
426 /// 431 ///
427 /// This is identical to calling `new Element.tag('aside')`. 432 /// This is equivalent to calling `new Element.tag('aside')`.
428 factory Element.aside() => new Element.tag('aside'); 433 factory Element.aside() => new Element.tag('aside');
429 434
430 /// Creates a new `<audio>` element. 435 /// Creates a new `<audio>` element.
431 /// 436 ///
432 /// This is identical to calling `new Element.tag('audio')`. 437 /// This is equivalent to calling `new Element.tag('audio')`.
433 factory Element.audio() => new Element.tag('audio'); 438 factory Element.audio() => new Element.tag('audio');
434 439
435 /// Creates a new `<br>` element. 440 /// Creates a new `<br>` element.
436 /// 441 ///
437 /// This is identical to calling `new Element.tag('br')`. 442 /// This is equivalent to calling `new Element.tag('br')`.
438 factory Element.br() => new Element.tag('br'); 443 factory Element.br() => new BRElement();
439 444
440 /// Creates a new `<canvas>` element. 445 /// Creates a new `<canvas>` element.
441 /// 446 ///
442 /// This is identical to calling `new Element.tag('canvas')`. 447 /// This is equivalent to calling `new Element.tag('canvas')`.
443 factory Element.canvas() => new Element.tag('canvas'); 448 factory Element.canvas() => new CanvasElement();
444 449
445 /// Creates a new `<div>` element. 450 /// Creates a new `<div>` element.
446 /// 451 ///
447 /// This is identical to calling `new Element.tag('div')`. 452 /// This is equivalent to calling `new Element.tag('div')`.
448 factory Element.div() => new Element.tag('div'); 453 factory Element.div() => new DivElement();
449 454
450 /// Creates a new `<footer>` element. 455 /// Creates a new `<footer>` element.
451 /// 456 ///
452 /// This is identical to calling `new Element.tag('footer')`. 457 /// This is equivalent to calling `new Element.tag('footer')`.
453 factory Element.footer() => new Element.tag('footer'); 458 factory Element.footer() => new Element.tag('footer');
454 459
455 /// Creates a new `<header>` element. 460 /// Creates a new `<header>` element.
456 /// 461 ///
457 /// This is identical to calling `new Element.tag('header')`. 462 /// This is equivalent to calling `new Element.tag('header')`.
458 factory Element.header() => new Element.tag('header'); 463 factory Element.header() => new Element.tag('header');
459 464
460 /// Creates a new `<hr>` element. 465 /// Creates a new `<hr>` element.
461 /// 466 ///
462 /// This is identical to calling `new Element.tag('hr')`. 467 /// This is equivalent to calling `new Element.tag('hr')`.
463 factory Element.hr() => new Element.tag('hr'); 468 factory Element.hr() => new Element.tag('hr');
464 469
465 /// Creates a new `<iframe>` element. 470 /// Creates a new `<iframe>` element.
466 /// 471 ///
467 /// This is identical to calling `new Element.tag('iframe')`. 472 /// This is equivalent to calling `new Element.tag('iframe')`.
468 factory Element.iframe() => new Element.tag('iframe'); 473 factory Element.iframe() => new Element.tag('iframe');
469 474
470 /// Creates a new `<img>` element. 475 /// Creates a new `<img>` element.
471 /// 476 ///
472 /// This is identical to calling `new Element.tag('img')`. 477 /// This is equivalent to calling `new Element.tag('img')`.
473 factory Element.img() => new Element.tag('img'); 478 factory Element.img() => new Element.tag('img');
474 479
475 /// Creates a new `<li>` element. 480 /// Creates a new `<li>` element.
476 /// 481 ///
477 /// This is identical to calling `new Element.tag('li')`. 482 /// This is equivalent to calling `new Element.tag('li')`.
478 factory Element.li() => new Element.tag('li'); 483 factory Element.li() => new Element.tag('li');
479 484
480 /// Creates a new `<nav>` element. 485 /// Creates a new `<nav>` element.
481 /// 486 ///
482 /// This is identical to calling `new Element.tag('nav')`. 487 /// This is equivalent to calling `new Element.tag('nav')`.
483 factory Element.nav() => new Element.tag('nav'); 488 factory Element.nav() => new Element.tag('nav');
484 489
485 /// Creates a new `<ol>` element. 490 /// Creates a new `<ol>` element.
486 /// 491 ///
487 /// This is identical to calling `new Element.tag('ol')`. 492 /// This is equivalent to calling `new Element.tag('ol')`.
488 factory Element.ol() => new Element.tag('ol'); 493 factory Element.ol() => new Element.tag('ol');
489 494
490 /// Creates a new `<option>` element. 495 /// Creates a new `<option>` element.
491 /// 496 ///
492 /// This is identical to calling `new Element.tag('option')`. 497 /// This is equivalent to calling `new Element.tag('option')`.
493 factory Element.option() => new Element.tag('option'); 498 factory Element.option() => new Element.tag('option');
494 499
495 /// Creates a new `<p>` element. 500 /// Creates a new `<p>` element.
496 /// 501 ///
497 /// This is identical to calling `new Element.tag('p')`. 502 /// This is equivalent to calling `new Element.tag('p')`.
498 factory Element.p() => new Element.tag('p'); 503 factory Element.p() => new Element.tag('p');
499 504
500 /// Creates a new `<pre>` element. 505 /// Creates a new `<pre>` element.
501 /// 506 ///
502 /// This is identical to calling `new Element.tag('pre')`. 507 /// This is equivalent to calling `new Element.tag('pre')`.
503 factory Element.pre() => new Element.tag('pre'); 508 factory Element.pre() => new Element.tag('pre');
504 509
505 /// Creates a new `<section>` element. 510 /// Creates a new `<section>` element.
506 /// 511 ///
507 /// This is identical to calling `new Element.tag('section')`. 512 /// This is equivalent to calling `new Element.tag('section')`.
508 factory Element.section() => new Element.tag('section'); 513 factory Element.section() => new Element.tag('section');
509 514
510 /// Creates a new `<select>` element. 515 /// Creates a new `<select>` element.
511 /// 516 ///
512 /// This is identical to calling `new Element.tag('select')`. 517 /// This is equivalent to calling `new Element.tag('select')`.
513 factory Element.select() => new Element.tag('select'); 518 factory Element.select() => new Element.tag('select');
514 519
515 /// Creates a new `<span>` element. 520 /// Creates a new `<span>` element.
516 /// 521 ///
517 /// This is identical to calling `new Element.tag('span')`. 522 /// This is equivalent to calling `new Element.tag('span')`.
518 factory Element.span() => new Element.tag('span'); 523 factory Element.span() => new Element.tag('span');
519 524
520 /// Creates a new `<svg>` element. 525 /// Creates a new `<svg>` element.
521 /// 526 ///
522 /// This is identical to calling `new Element.tag('svg')`. 527 /// This is equivalent to calling `new Element.tag('svg')`.
523 factory Element.svg() => new Element.tag('svg'); 528 factory Element.svg() => new Element.tag('svg');
524 529
525 /// Creates a new `<table>` element. 530 /// Creates a new `<table>` element.
526 /// 531 ///
527 /// This is identical to calling `new Element.tag('table')`. 532 /// This is equivalent to calling `new Element.tag('table')`.
528 factory Element.table() => new Element.tag('table'); 533 factory Element.table() => new Element.tag('table');
529 534
530 /// Creates a new `<td>` element. 535 /// Creates a new `<td>` element.
531 /// 536 ///
532 /// This is identical to calling `new Element.tag('td')`. 537 /// This is equivalent to calling `new Element.tag('td')`.
533 factory Element.td() => new Element.tag('td'); 538 factory Element.td() => new Element.tag('td');
534 539
535 /// Creates a new `<textarea>` element. 540 /// Creates a new `<textarea>` element.
536 /// 541 ///
537 /// This is identical to calling `new Element.tag('textarea')`. 542 /// This is equivalent to calling `new Element.tag('textarea')`.
538 factory Element.textarea() => new Element.tag('textarea'); 543 factory Element.textarea() => new Element.tag('textarea');
539 544
540 /// Creates a new `<th>` element. 545 /// Creates a new `<th>` element.
541 /// 546 ///
542 /// This is identical to calling `new Element.tag('th')`. 547 /// This is equivalent to calling `new Element.tag('th')`.
543 factory Element.th() => new Element.tag('th'); 548 factory Element.th() => new Element.tag('th');
544 549
545 /// Creates a new `<tr>` element. 550 /// Creates a new `<tr>` element.
546 /// 551 ///
547 /// This is identical to calling `new Element.tag('tr')`. 552 /// This is equivalent to calling `new Element.tag('tr')`.
548 factory Element.tr() => new Element.tag('tr'); 553 factory Element.tr() => new Element.tag('tr');
549 554
550 /// Creates a new `<ul>` element. 555 /// Creates a new `<ul>` element.
551 /// 556 ///
552 /// This is identical to calling `new Element.tag('ul')`. 557 /// This is equivalent to calling `new Element.tag('ul')`.
553 factory Element.ul() => new Element.tag('ul'); 558 factory Element.ul() => new Element.tag('ul');
554 559
555 /// Creates a new `<video>` element. 560 /// Creates a new `<video>` element.
556 /// 561 ///
557 /// This is identical to calling `new Element.tag('video')`. 562 /// This is equivalent to calling `new Element.tag('video')`.
558 factory Element.video() => new Element.tag('video'); 563 factory Element.video() => new Element.tag('video');
559 564
560 /** 565 /**
561 * All attributes on this element. 566 * All attributes on this element.
562 * 567 *
563 * Any modifications to the attribute map will automatically be applied to 568 * Any modifications to the attribute map will automatically be applied to
564 * this element. 569 * this element.
565 * 570 *
566 * This only includes attributes which are not in a namespace 571 * This only includes attributes which are not in a namespace
567 * (such as 'xlink:href'), additional attributes can be accessed via 572 * (such as 'xlink:href'), additional attributes can be accessed via
(...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1669 const ScrollAlignment._internal(this._value); 1674 const ScrollAlignment._internal(this._value);
1670 toString() => 'ScrollAlignment.$_value'; 1675 toString() => 'ScrollAlignment.$_value';
1671 1676
1672 /// Attempt to align the element to the top of the scrollable area. 1677 /// Attempt to align the element to the top of the scrollable area.
1673 static const TOP = const ScrollAlignment._internal('TOP'); 1678 static const TOP = const ScrollAlignment._internal('TOP');
1674 /// Attempt to center the element in the scrollable area. 1679 /// Attempt to center the element in the scrollable area.
1675 static const CENTER = const ScrollAlignment._internal('CENTER'); 1680 static const CENTER = const ScrollAlignment._internal('CENTER');
1676 /// Attempt to align the element to the bottom of the scrollable area. 1681 /// Attempt to align the element to the bottom of the scrollable area.
1677 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); 1682 static const BOTTOM = const ScrollAlignment._internal('BOTTOM');
1678 } 1683 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698