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 {} |