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

Unified Diff: test/codegen/sunflower/dom.dart

Issue 1200233004: fixes #168, dart:js implementation with a test (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: fix error (window not defined) Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/codegen/expect/sunflower/sunflower.html ('k') | tool/input_sdk/lib/js/dart2js/js_dart2js.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/codegen/sunflower/dom.dart
diff --git a/test/codegen/sunflower/dom.dart b/test/codegen/sunflower/dom.dart
index 9a5f2668582d7ca4182213f6fe744274aa6c698d..efea61bd6650a244ecb48264923deafaae3a2064 100644
--- a/test/codegen/sunflower/dom.dart
+++ b/test/codegen/sunflower/dom.dart
@@ -5,6 +5,8 @@
@JsName(name: 'window')
library dom;
+@JsName()
+class Window {}
class JsName {
/// The JavaScript name.
@@ -20,22 +22,53 @@ class Overload {
const overload = const Overload();
external Document get document;
+external Window get window;
-@JsName(name: 'Document')
-abstract class Document {
+@JsName()
+abstract class Document extends Node {
Element createElement(String name);
Element querySelector(String selector);
+
+ HTMLElement head;
+ HTMLElement body;
+}
+
+@JsName()
+class Blob {
+ external Blob(blobParts, {String type});
}
-@JsName(name: 'Element')
-abstract class Element {
+class CustomEvent {
+ external CustomEvent(String type, {detail, bubbles, cancelable});
+}
+
+@JsName()
+abstract class Element extends Node {
void addEventListener(String type, EventListener callback, [bool capture]);
String textContent;
- NodeList get childNodes;
}
@JsName()
-class Node {}
+abstract class HTMLElement extends Element {
+ String innerHTML;
+ HTMLCollection get children;
+}
+
+@JsName()
+abstract class Node {
+ bool hasChildNodes();
+ NodeList get childNodes;
+
+ Node insertBefore(Node node, [Node child]);
+ Node appendChild(Node node);
+ Node replaceChild(Node node, Node child);
+ Node removeChild(Node child);
+}
+
+abstract class HTMLCollection {
+ int get length;
+ external Element operator [](num index);
+}
@JsName()
class NodeList {
@@ -53,16 +86,28 @@ typedef void EventListener(Event e);
@JsName()
abstract class Event {}
+// TODO(jmesserly): rename these
@JsName(name: 'HTMLInputElement')
-abstract class InputElement extends Element {
+abstract class InputElement extends HTMLElement {
String value;
}
@JsName(name: 'HTMLCanvasElement')
-abstract class CanvasElement extends Element {
+abstract class CanvasElement extends HTMLElement {
RenderingContext getContext(String contextId);
}
+@JsName(name: 'HTMLDivElement')
+abstract class DivElement extends HTMLElement {
+ RenderingContext getContext(String contextId);
+}
+
+@JsName(name: 'HTMLScriptElement')
+abstract class ScriptElement extends HTMLElement {
+ String type;
+}
+
+
// TODO(jmesserly): union type of CanvasRenderingContext2D and
// WebGLRenderingContext
abstract class RenderingContext {}
« no previous file with comments | « test/codegen/expect/sunflower/sunflower.html ('k') | tool/input_sdk/lib/js/dart2js/js_dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698