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

Unified Diff: test/browser/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 | « lib/src/js/nodes.dart ('k') | test/browser/index.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/browser/dom.dart
diff --git a/test/codegen/sunflower/dom.dart b/test/browser/dom.dart
similarity index 83%
copy from test/codegen/sunflower/dom.dart
copy to test/browser/dom.dart
index 9a5f2668582d7ca4182213f6fe744274aa6c698d..6db45da62ed6ef7bd8d62ef4fa9d85012faa2b67 100644
--- a/test/codegen/sunflower/dom.dart
+++ b/test/browser/dom.dart
@@ -5,6 +5,8 @@
@JsName(name: 'window')
library dom;
+@JsName()
+class Window {}
class JsName {
/// The JavaScript name.
@@ -20,22 +22,55 @@ 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 {
+@JsName()
+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;
+}
+
+@JsName()
+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);
}
@JsName()
-class Node {}
+abstract class HTMLCollection {
+ int get length;
+ external Element operator [](num index);
+}
@JsName()
class NodeList {
@@ -53,16 +88,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 | « lib/src/js/nodes.dart ('k') | test/browser/index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698