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

Unified Diff: sdk/lib/html/dartium/html_dartium.dart

Side-by-side diff isn't available for this file because of its large size.
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:
Download patch
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | sdk/lib/svg/dart2js/svg_dart2js.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/dartium/html_dartium.dart
diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
index e4f8fe3bbcde259a7de30d6ab31fc4cc0df15c7d..321c374b9068088dd3a2ea2adebf52e26f104bb9 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -5633,7 +5633,7 @@ class CssStyleDeclaration extends DartHtmlDomObject with
factory CssStyleDeclaration() => new CssStyleDeclaration.css('');
factory CssStyleDeclaration.css(String css) {
- final style = new Element.tag('div').style;
+ final style = new DivElement().style;
style.cssText = css;
return style;
}
@@ -11056,7 +11056,7 @@ class DocumentFragment extends Node implements NonElementParentNode, ParentNode
String get innerHtml {
- final e = new Element.tag("div");
+ final e = new DivElement();
e.append(this.clone(true));
return e.innerHtml;
}
@@ -13753,9 +13753,14 @@ class Element extends Node implements NonDocumentTypeChildNode, GlobalEventHandl
* var myElement = new Element.tag('unknownTag');
* print(myElement is UnknownElement); // 'true'
*
- * For standard elements it is more preferable to use the type constructors:
+ * For standard elements it is better to use the element type constructors:
+ *
* var element = new DivElement();
*
+ * It is better to use e.g `new CanvasElement()` because the type of the
+ * expression is `CanvasElement`, whereas the type of `Element.tag` is the
+ * less specific `Element`.
+ *
* See also:
*
* * [isTagSupported]
@@ -13765,147 +13770,147 @@ class Element extends Node implements NonDocumentTypeChildNode, GlobalEventHandl
/// Creates a new `<a>` element.
///
- /// This is identical to calling `new Element.tag('a')`.
- factory Element.a() => new Element.tag('a');
+ /// This is equivalent to calling `new Element.tag('a')`.
+ factory Element.a() => new AnchorElement();
/// Creates a new `<article>` element.
///
- /// This is identical to calling `new Element.tag('article')`.
+ /// This is equivalent to calling `new Element.tag('article')`.
factory Element.article() => new Element.tag('article');
/// Creates a new `<aside>` element.
///
- /// This is identical to calling `new Element.tag('aside')`.
+ /// This is equivalent to calling `new Element.tag('aside')`.
factory Element.aside() => new Element.tag('aside');
/// Creates a new `<audio>` element.
///
- /// This is identical to calling `new Element.tag('audio')`.
+ /// This is equivalent to calling `new Element.tag('audio')`.
factory Element.audio() => new Element.tag('audio');
/// Creates a new `<br>` element.
///
- /// This is identical to calling `new Element.tag('br')`.
- factory Element.br() => new Element.tag('br');
+ /// This is equivalent to calling `new Element.tag('br')`.
+ factory Element.br() => new BRElement();
/// Creates a new `<canvas>` element.
///
- /// This is identical to calling `new Element.tag('canvas')`.
- factory Element.canvas() => new Element.tag('canvas');
+ /// This is equivalent to calling `new Element.tag('canvas')`.
+ factory Element.canvas() => new CanvasElement();
/// Creates a new `<div>` element.
///
- /// This is identical to calling `new Element.tag('div')`.
- factory Element.div() => new Element.tag('div');
+ /// This is equivalent to calling `new Element.tag('div')`.
+ factory Element.div() => new DivElement();
/// Creates a new `<footer>` element.
///
- /// This is identical to calling `new Element.tag('footer')`.
+ /// This is equivalent to calling `new Element.tag('footer')`.
factory Element.footer() => new Element.tag('footer');
/// Creates a new `<header>` element.
///
- /// This is identical to calling `new Element.tag('header')`.
+ /// This is equivalent to calling `new Element.tag('header')`.
factory Element.header() => new Element.tag('header');
/// Creates a new `<hr>` element.
///
- /// This is identical to calling `new Element.tag('hr')`.
+ /// This is equivalent to calling `new Element.tag('hr')`.
factory Element.hr() => new Element.tag('hr');
/// Creates a new `<iframe>` element.
///
- /// This is identical to calling `new Element.tag('iframe')`.
+ /// This is equivalent to calling `new Element.tag('iframe')`.
factory Element.iframe() => new Element.tag('iframe');
/// Creates a new `<img>` element.
///
- /// This is identical to calling `new Element.tag('img')`.
+ /// This is equivalent to calling `new Element.tag('img')`.
factory Element.img() => new Element.tag('img');
/// Creates a new `<li>` element.
///
- /// This is identical to calling `new Element.tag('li')`.
+ /// This is equivalent to calling `new Element.tag('li')`.
factory Element.li() => new Element.tag('li');
/// Creates a new `<nav>` element.
///
- /// This is identical to calling `new Element.tag('nav')`.
+ /// This is equivalent to calling `new Element.tag('nav')`.
factory Element.nav() => new Element.tag('nav');
/// Creates a new `<ol>` element.
///
- /// This is identical to calling `new Element.tag('ol')`.
+ /// This is equivalent to calling `new Element.tag('ol')`.
factory Element.ol() => new Element.tag('ol');
/// Creates a new `<option>` element.
///
- /// This is identical to calling `new Element.tag('option')`.
+ /// This is equivalent to calling `new Element.tag('option')`.
factory Element.option() => new Element.tag('option');
/// Creates a new `<p>` element.
///
- /// This is identical to calling `new Element.tag('p')`.
+ /// This is equivalent to calling `new Element.tag('p')`.
factory Element.p() => new Element.tag('p');
/// Creates a new `<pre>` element.
///
- /// This is identical to calling `new Element.tag('pre')`.
+ /// This is equivalent to calling `new Element.tag('pre')`.
factory Element.pre() => new Element.tag('pre');
/// Creates a new `<section>` element.
///
- /// This is identical to calling `new Element.tag('section')`.
+ /// This is equivalent to calling `new Element.tag('section')`.
factory Element.section() => new Element.tag('section');
/// Creates a new `<select>` element.
///
- /// This is identical to calling `new Element.tag('select')`.
+ /// This is equivalent to calling `new Element.tag('select')`.
factory Element.select() => new Element.tag('select');
/// Creates a new `<span>` element.
///
- /// This is identical to calling `new Element.tag('span')`.
+ /// This is equivalent to calling `new Element.tag('span')`.
factory Element.span() => new Element.tag('span');
/// Creates a new `<svg>` element.
///
- /// This is identical to calling `new Element.tag('svg')`.
+ /// This is equivalent to calling `new Element.tag('svg')`.
factory Element.svg() => new Element.tag('svg');
/// Creates a new `<table>` element.
///
- /// This is identical to calling `new Element.tag('table')`.
+ /// This is equivalent to calling `new Element.tag('table')`.
factory Element.table() => new Element.tag('table');
/// Creates a new `<td>` element.
///
- /// This is identical to calling `new Element.tag('td')`.
+ /// This is equivalent to calling `new Element.tag('td')`.
factory Element.td() => new Element.tag('td');
/// Creates a new `<textarea>` element.
///
- /// This is identical to calling `new Element.tag('textarea')`.
+ /// This is equivalent to calling `new Element.tag('textarea')`.
factory Element.textarea() => new Element.tag('textarea');
/// Creates a new `<th>` element.
///
- /// This is identical to calling `new Element.tag('th')`.
+ /// This is equivalent to calling `new Element.tag('th')`.
factory Element.th() => new Element.tag('th');
/// Creates a new `<tr>` element.
///
- /// This is identical to calling `new Element.tag('tr')`.
+ /// This is equivalent to calling `new Element.tag('tr')`.
factory Element.tr() => new Element.tag('tr');
/// Creates a new `<ul>` element.
///
- /// This is identical to calling `new Element.tag('ul')`.
+ /// This is equivalent to calling `new Element.tag('ul')`.
factory Element.ul() => new Element.tag('ul');
/// Creates a new `<video>` element.
///
- /// This is identical to calling `new Element.tag('video')`.
+ /// This is equivalent to calling `new Element.tag('video')`.
factory Element.video() => new Element.tag('video');
/**
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | sdk/lib/svg/dart2js/svg_dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698