aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbors-servo <release+servo@mozilla.com>2013-10-16 03:01:11 -0700
committerbors-servo <release+servo@mozilla.com>2013-10-16 03:01:11 -0700
commit02ef301770db02235531df21895d53a785105b95 (patch)
treefdc4954be881091e70a9e9b0825b2de93ba273a6 /src
parent509934cf65acb1061cf4b012556ff6782e3203c9 (diff)
parent20b58ddab9c59ee1f4944478e8c2f568e4c27be8 (diff)
downloadservo-02ef301770db02235531df21895d53a785105b95.tar.gz
servo-02ef301770db02235531df21895d53a785105b95.zip
auto merge of #1070 : kmcallister/servo/test-bindings, r=jdm
Diffstat (limited to 'src')
-rw-r--r--src/test/html/content/harness.js37
-rw-r--r--src/test/html/content/test_DOMParser.html12
-rw-r--r--src/test/html/content/test_Event.html21
-rw-r--r--src/test/html/content/test_MouseEvent.html22
-rw-r--r--src/test/html/content/test_childnodes.html4
-rw-r--r--src/test/html/content/test_collections.html140
-rw-r--r--src/test/html/content/test_create_element.html6
-rw-r--r--src/test/html/content/test_documentElement.html14
-rw-r--r--src/test/html/content/test_document_getElementById.html6
-rw-r--r--src/test/html/content/test_empty_clientrect.html4
-rw-r--r--src/test/html/content/test_getBoundingClientRect.html32
-rw-r--r--src/test/html/content/test_getClientRects.html40
-rw-r--r--src/test/html/content/test_getElementsByTagName.html18
-rw-r--r--src/test/html/content/test_navigator.html2
-rw-r--r--src/test/html/content/test_prototypes.html14
-rw-r--r--src/test/html/content/test_title.html12
-rw-r--r--src/test/html/test_bindings.html369
17 files changed, 356 insertions, 397 deletions
diff --git a/src/test/html/content/harness.js b/src/test/html/content/harness.js
index a7da6e7cd6e..0697376df4f 100644
--- a/src/test/html/content/harness.js
+++ b/src/test/html/content/harness.js
@@ -1,22 +1,39 @@
+function _oneline(x) {
+ var i = x.indexOf("\n");
+ return (i == -1) ? x : (x.slice(0, i) + "...");
+}
+
function _fail(s, m) {
// string split to avoid problems with tests that end up printing the value of window._fail.
- window.alert("TEST-UNEXPECTED" + "-FAIL | " + s + ": " + m);
+ window.alert(_oneline("TEST-UNEXPECTED" + "-FAIL | " + s + ": " + m));
}
function _pass(s, m) {
- window.alert("TEST-PASS | " + s + ": " + m);
+ window.alert(_oneline("TEST-PASS | " + s + ": " + m));
}
-function is(a, b, c) {
- let f = a != b ? _fail : _pass;
- let m = !c ? "" : c;
- f(a + " == " + b, m);
+function _printer(opstr, op) {
+ return function (a, b, msg) {
+ let f = op(a,b) ? _pass : _fail;
+ if (!msg) msg = "";
+ f(a + " " + opstr + " " + b, msg);
+ };
}
-function isnot(a, b, c) {
- let f = (a != b) ? _pass : _fail;
- let m = !c ? "" : c;
- f(a + " != " + b, m);
+var is = _printer("==", function (a,b) { return a == b; });
+var is_a = _printer("is a", function (a,b) { return a instanceof b; });
+var is_in = _printer("is in", function (a,b) { return a in b; });
+var is_not_in = _printer("is not in", function (a,b) { return !(a in b); });
+var as_str_is = _printer("as string is", function (a,b) { return String(a) == b; });
+var isnot = _printer("!=", function (a,b) { return a != b; });
+var lt = _printer("<", function (a,b) { return a < b; });
+var gt = _printer(">", function (a,b) { return a > b; });
+var leq = _printer("<=", function (a,b) { return a <= b; });
+var geq = _printer(">=", function (a,b) { return a >= b; });
+var starts_with = _printer("starts with", function (a,b) { return a.indexOf(b) == 0; });
+
+function is_function(val, name) {
+ starts_with(String(val), "function " + name + "(");
}
var _test_complete = false;
diff --git a/src/test/html/content/test_DOMParser.html b/src/test/html/content/test_DOMParser.html
new file mode 100644
index 00000000000..50c3b4f4f5f
--- /dev/null
+++ b/src/test/html/content/test_DOMParser.html
@@ -0,0 +1,12 @@
+<html>
+<head>
+<script src="harness.js"></script>
+<script>
+is_function(DOMParser, "DOMParser");
+let parser = new DOMParser();
+is_a(parser, DOMParser);
+//is_a(parser.parseFromString("", "text/html"), Document);
+finish();
+</script>
+</head>
+</html>
diff --git a/src/test/html/content/test_Event.html b/src/test/html/content/test_Event.html
new file mode 100644
index 00000000000..6b24d46daab
--- /dev/null
+++ b/src/test/html/content/test_Event.html
@@ -0,0 +1,21 @@
+<html>
+<head>
+<script src="harness.js"></script>
+<script>
+is_function(Event, "Event");
+
+/* broken due to #1042
+let ev = new Event("foopy");
+is_a(ev, Event);
+
+// FIXME: assert correct values
+alert(ev.type);
+alert(ev.defaultPrevented);
+ev.preventDefault();
+alert(ev.defaultPrevented);
+*/
+
+finish();
+</script>
+</head>
+</html>
diff --git a/src/test/html/content/test_MouseEvent.html b/src/test/html/content/test_MouseEvent.html
new file mode 100644
index 00000000000..2fb8d413e88
--- /dev/null
+++ b/src/test/html/content/test_MouseEvent.html
@@ -0,0 +1,22 @@
+<html>
+<head>
+<script src="harness.js"></script>
+<script>
+is_function(MouseEvent, "MouseEvent");
+
+/* broken due to #1042
+let ev = new MouseEvent("press", {bubbles: true, screenX: 150, detail: 100});
+
+// FIXME: assert correct values
+alert(ev);
+alert(ev.screenX);
+alert(ev.detail);
+alert(ev.getModifierState("ctrl"));
+is_a(ev, Event);
+is_a(ev, UIEvent);
+*/
+
+finish();
+</script>
+</head>
+</html>
diff --git a/src/test/html/content/test_childnodes.html b/src/test/html/content/test_childnodes.html
index f8a4d9797c6..205a6124959 100644
--- a/src/test/html/content/test_childnodes.html
+++ b/src/test/html/content/test_childnodes.html
@@ -18,11 +18,11 @@
var child2 = document.createElement("p");
elem.appendChild(child2);
- is(1 in children, true);
+ is_in(1, children);
is(children.length, 2);
is(children.item(1), child2);
- is(!(2 in children), true);
+ is_not_in(2, children);
is(children.item(2), null);
finish();
diff --git a/src/test/html/content/test_collections.html b/src/test/html/content/test_collections.html
new file mode 100644
index 00000000000..93837eb0c86
--- /dev/null
+++ b/src/test/html/content/test_collections.html
@@ -0,0 +1,140 @@
+<html>
+<head>
+<title>test_binding
+ page </title>
+<base href="./"></base>
+<script src="harness.js"></script>
+<script>
+function check_collection(obj, num, classes, name) {
+ is_a(obj, HTMLCollection);
+ is(obj.length, num);
+ is(obj[obj.length], null);
+
+ if (classes === undefined)
+ return;
+
+ classes = [Element, HTMLElement].concat(classes);
+
+ for (var i=0; i<obj.length; i++) {
+ isnot(obj[i], null);
+ is(obj[i].tagName, name);
+ for (var j=0; j<classes.length; j++) {
+ is_a(obj[i], classes[j]);
+ }
+ }
+}
+
+function check_tag(tagname, num, classes) {
+ check_collection(document.getElementsByTagName(tagname), num, classes, tagname.toUpperCase());
+}
+
+check_collection(document.links, 1, [HTMLAnchorElement], "A");
+check_collection(document.images, 1, [HTMLImageElement], "IMG");
+check_collection(document.embeds, 1, [HTMLEmbedElement], "EMBED");
+check_collection(document.plugins, 1, [HTMLEmbedElement], "EMBED");
+check_collection(document.scripts, 2, [HTMLScriptElement], "SCRIPT");
+check_collection(document.applets, 1, [HTMLAppletElement], "APPLET");
+check_collection(document.forms, 1, [HTMLFormElement], "FORM");
+
+check_collection(document.getElementsByName("test"), 2);
+check_collection(document.getElementsByTagName("nosuchtag"), 0);
+
+check_tag("section", 1, []);
+check_tag("aside", 1, []);
+check_tag("b", 1, []);
+check_tag("i", 1, []);
+check_tag("small", 1, []);
+check_tag("head", 1, [HTMLHeadElement]);
+check_tag("div", 3, [HTMLDivElement]);
+check_tag("iframe", 1, [HTMLIFrameElement]);
+check_tag("body", 1, [HTMLBodyElement]);
+check_tag("area", 1, [HTMLAreaElement]);
+check_tag("base", 1, [HTMLBaseElement]);
+check_tag("data", 1, [HTMLDataElement]);
+check_tag("ol", 1, [HTMLOListElement]);
+check_tag("canvas", 1, [HTMLCanvasElement]);
+check_tag("source", 2, [HTMLSourceElement]);
+check_tag("time", 1, [HTMLTimeElement]);
+check_tag("caption", 1, [HTMLTableCaptionElement]);
+check_tag("textarea", 1, [HTMLTextAreaElement]);
+check_tag("q", 1, [HTMLQuoteElement]);
+check_tag("th", 1, [HTMLTableCellElement, HTMLTableHeaderCellElement]);
+check_tag("td", 1, [HTMLTableCellElement, HTMLTableDataCellElement]);
+check_tag("col", 1, [HTMLTableColElement]);
+check_tag("colgroup", 1, [HTMLTableColElement]);
+check_tag("input", 2, [HTMLInputElement]);
+check_tag("li", 1, [HTMLLIElement]);
+check_tag("progress", 1, [HTMLProgressElement]);
+check_tag("template", 1, [HTMLTemplateElement]);
+check_tag("pre", 1, [HTMLPreElement]);
+check_tag("legend", 1, [HTMLLegendElement]);
+check_tag("label", 1, [HTMLLabelElement]);
+check_tag("track", 1, [HTMLTrackElement]);
+check_tag("audio", 1, [HTMLMediaElement, HTMLAudioElement]);
+check_tag("video", 1, [HTMLMediaElement, HTMLVideoElement]);
+
+// FIXME: Test non-ASCII tag names
+check_tag("foo", 1, [HTMLUnknownElement]);
+
+finish();
+</script>
+</head>
+<body>
+
+<div id="first" name="test">fffff<br><br><br><br>fffffffffffffffff</div>
+<div id="second">ggg</div>
+<span id="third" name="test">hhhhhhhh</span>
+<div id="fourth">iiiiiiiiiiiiiiiiiii</div>
+<a href="http://www.mozilla.org"></a>
+<img src="test.jpg"/>
+<embed></embed>
+<form>
+ <fieldset>
+ <legend>legend</legend>
+ <label for="">label<input type="text" value="input" /></label>
+ </fieldset>
+</form>
+<hr />
+<canvas/>
+<p>pppppppppp</p>
+<q>qqqqqqqqqqqqqqqqqqqqqqqqqqq</q>
+<progress max="100" value="80">80%</progress>
+<applet></applet>
+<input type="text" value="input"/>
+<iframe></iframe>
+<ol type="1">
+ <li>li</li>
+</ol>
+<table>
+ <caption>sample table</caption>
+ <colgroup>
+ <col/>
+ </colgroup>
+ <tbody>
+ <tr><th>head</th></tr>
+ <tr><td>data</td></tr>
+ </tbody>
+</table>
+<section>section</section>
+<aside>aside</aside>
+<b>b</b>
+<i>i</i>
+<small>small</small>
+<textarea>textarea</textarea>
+<time datetime="2014-02-14">Valentines day</time>
+<area></area>
+<data></data>
+<template></template>
+<pre>pre</pre>
+<audio>
+ <source src="horse.ogg" type="audio/ogg">
+ <source src="horse.mp3" type="audio/mpeg">
+</audio>
+<video src="">
+ <track></track>
+</video>
+
+<foo>hi</foo>
+
+</body>
+</html>
diff --git a/src/test/html/content/test_create_element.html b/src/test/html/content/test_create_element.html
index eaa3e11377a..f62c599504d 100644
--- a/src/test/html/content/test_create_element.html
+++ b/src/test/html/content/test_create_element.html
@@ -8,11 +8,11 @@
var elem = document.createElement("foo");
is(elem.tagName, "FOO");
var elem = document.createElement("p");
- is(elem instanceof HTMLParagraphElement, true);
+ is_a(elem, HTMLParagraphElement);
var elem = document.createElement("sPAn");
- is(elem instanceof HTMLSpanElement, true);
+ is_a(elem, HTMLSpanElement);
var text = document.createTextNode("hello");
- is(text instanceof Text, true);
+ is_a(text, Text);
finish();
</script>
</body>
diff --git a/src/test/html/content/test_documentElement.html b/src/test/html/content/test_documentElement.html
new file mode 100644
index 00000000000..0c38828084e
--- /dev/null
+++ b/src/test/html/content/test_documentElement.html
@@ -0,0 +1,14 @@
+<html>
+<head>
+<script src="harness.js"></script>
+<script>
+is_a(window, Window);
+is_a(document.documentElement, HTMLHtmlElement);
+is_a(document.documentElement.firstChild, HTMLHtmlElement);
+is(document.documentElement.nextSibling, null);
+is_a(document, HTMLDocument);
+is_a(document, Document);
+finish();
+</script>
+</head>
+</html>
diff --git a/src/test/html/content/test_document_getElementById.html b/src/test/html/content/test_document_getElementById.html
index 20140274477..370ec77fde0 100644
--- a/src/test/html/content/test_document_getElementById.html
+++ b/src/test/html/content/test_document_getElementById.html
@@ -13,12 +13,12 @@
let foo = document.getElementById("foo");
isnot(foo, null, "test-1-0, on static page");
is(foo && foo.tagName, "HEAD", "test1-1, on static page");
- is(foo instanceof HTMLHeadElement, true, "test1-2, on static page");
+ is_a(foo, HTMLHeadElement, "test1-2, on static page");
let bar = document.getElementById("bar");
isnot(bar, null, "test1-3, on static page");
is(bar && bar.tagName, "DIV", "test1-4, on static page");
- is(bar instanceof HTMLDivElement, true, "test1-5, on static page");
+ is_a(bar, HTMLDivElement, "test1-5, on static page");
}
// test2: scripted element
@@ -32,7 +32,7 @@
let appended = document.getElementById(TEST_ID);
isnot(appended, null, "test2-0, appended element");
is(appended && appended.tagName, "DIV", "test2-1, appended element");
- is(appended instanceof HTMLDivElement, true, "test2-2, appended element");
+ is_a(appended, HTMLDivElement, "test2-2, appended element");
// test: removed element
gBody.removeChild(test);
diff --git a/src/test/html/content/test_empty_clientrect.html b/src/test/html/content/test_empty_clientrect.html
index 3902886ee99..3671ca5bcc4 100644
--- a/src/test/html/content/test_empty_clientrect.html
+++ b/src/test/html/content/test_empty_clientrect.html
@@ -4,14 +4,14 @@
<script>
var rect = window.document.head.getBoundingClientRect();
var rects = window.document.head.getClientRects();
-is(rect instanceof ClientRect, true);
+is_a(rect, ClientRect);
is(rect.top, 0);
is(rect.bottom, 0);
is(rect.left, 0);
is(rect.right, 0);
is(rect.width, 0);
is(rect.height, 0);
-is(rects instanceof ClientRectList, true);
+is_a(rects, ClientRectList);
is(rects.length, 0);
finish();
</script>
diff --git a/src/test/html/content/test_getBoundingClientRect.html b/src/test/html/content/test_getBoundingClientRect.html
new file mode 100644
index 00000000000..8ccd55a7df3
--- /dev/null
+++ b/src/test/html/content/test_getBoundingClientRect.html
@@ -0,0 +1,32 @@
+<html>
+<head>
+<script src="harness.js"></script>
+<script>
+is_function(ClientRect, "ClientRect");
+is_function(ClientRectList, "ClientRectList");
+
+var elems = document.getElementsByTagName('div');
+var rect = elems[0].getBoundingClientRect();
+is_a(rect, ClientRect);
+
+geq(rect.top, 100);
+geq(rect.bottom, 100);
+geq(rect.left, 100);
+geq(rect.right, 100);
+
+is(rect.width, rect.right - rect.left);
+is(rect.height, rect.bottom - rect.top);
+
+finish();
+</script>
+<style>
+div {
+ margin-top: 100px;
+ margin-left: 100px;
+}
+</style>
+</head>
+<body>
+ <div>my div</div>
+</body>
+</html>
diff --git a/src/test/html/content/test_getClientRects.html b/src/test/html/content/test_getClientRects.html
new file mode 100644
index 00000000000..6570e1c8455
--- /dev/null
+++ b/src/test/html/content/test_getClientRects.html
@@ -0,0 +1,40 @@
+<html>
+<head>
+<script src="harness.js"></script>
+<script>
+var elems = document.getElementsByTagName('div');
+var rects = elems[0].getClientRects();
+is_a(rects, ClientRectList);
+
+is(rects.length, 3);
+
+for (var i=0; i<rects.length; i++) {
+ var rect = rects[i];
+ is_a(rect, ClientRect);
+
+ geq(rect.top, 100);
+ geq(rect.bottom, 100);
+ geq(rect.left, 100);
+ geq(rect.right, 100);
+
+ is(rect.width, rect.right - rect.left);
+ is(rect.height, rect.bottom - rect.top);
+}
+
+finish();
+</script>
+<style>
+div {
+ margin-top: 100px;
+ margin-left: 100px;
+}
+</style>
+</head>
+<body>
+ <div>
+ my div
+ <div>foo</div>
+ <div>bar</div>
+ </div>
+</body>
+</html>
diff --git a/src/test/html/content/test_getElementsByTagName.html b/src/test/html/content/test_getElementsByTagName.html
new file mode 100644
index 00000000000..34d31d0e318
--- /dev/null
+++ b/src/test/html/content/test_getElementsByTagName.html
@@ -0,0 +1,18 @@
+<html>
+<head>
+<script src="harness.js"></script>
+<script>
+var elems = document.getElementsByTagName('div');
+is(elems.length, 2);
+let elem = elems[0];
+is(elem.nodeType, 1);
+is_a(elem, HTMLDivElement);
+is(elem.tagName, "DIV");
+finish();
+</script>
+</head>
+<body>
+ <div>div one</div>
+ <div>div two</div>
+</body>
+</html>
diff --git a/src/test/html/content/test_navigator.html b/src/test/html/content/test_navigator.html
index 7d786ea8ec6..c7809f36895 100644
--- a/src/test/html/content/test_navigator.html
+++ b/src/test/html/content/test_navigator.html
@@ -6,7 +6,7 @@
<body>
<script>
is(window.navigator, window.navigator);
-is(String(window.navigator), '[object Navigator]');
+is_a(window.navigator, Navigator);
var nav = window.navigator;
is(nav.doNotTrack, "unspecified");
diff --git a/src/test/html/content/test_prototypes.html b/src/test/html/content/test_prototypes.html
index 9eb3e878e31..61835bd750e 100644
--- a/src/test/html/content/test_prototypes.html
+++ b/src/test/html/content/test_prototypes.html
@@ -5,14 +5,14 @@
<body>
<foo-á>foo</foo-á>
<script>
-is(window.document.documentElement instanceof Node, true);
-is(window.document.documentElement instanceof Element, true);
-is(window.document.documentElement instanceof HTMLElement, true);
-is(window.document.documentElement instanceof HTMLHtmlElement, true);
-is(window.document instanceof Document, true);
-is(window.document instanceof HTMLDocument, true);
+is_a(window.document.documentElement, Node);
+is_a(window.document.documentElement, Element);
+is_a(window.document.documentElement, HTMLElement);
+is_a(window.document.documentElement, HTMLHtmlElement);
+is_a(window.document, Document);
+is_a(window.document, HTMLDocument);
is(window.document.documentElement.tagName, "HTML");
-is(window.document.getElementsByTagName('foo-á')[0] instanceof HTMLUnknownElement, true);
+is_a(window.document.getElementsByTagName('foo-á')[0], HTMLUnknownElement);
is(window.document.getElementsByTagName('foo-á')[0].tagName, "FOO-á");
finish();
</script>
diff --git a/src/test/html/content/test_title.html b/src/test/html/content/test_title.html
new file mode 100644
index 00000000000..da3dcfc7112
--- /dev/null
+++ b/src/test/html/content/test_title.html
@@ -0,0 +1,12 @@
+<html>
+<head>
+<title>starting title</title>
+<script src="harness.js"></script>
+<script>
+is(document.title, "starting title");
+document.title = "new title";
+is(document.title, "new title");
+finish();
+</script>
+</head>
+</html>
diff --git a/src/test/html/test_bindings.html b/src/test/html/test_bindings.html
deleted file mode 100644
index b2bc4a8fcb3..00000000000
--- a/src/test/html/test_bindings.html
+++ /dev/null
@@ -1,369 +0,0 @@
-<!DOCTYPE html>
-<html>
- <!-- comment -->
- <head>
- <title>test_binding
- page </title>
- <base href="./"></base>
-<script>
-//window.alert(ClientRect);
-//window.alert(ClientRectList);
-window.alert(window);
-var document = window.document;
-window.alert("==1==");
-window.alert(document.documentElement);
-window.alert(document.documentElement.firstChild);
-window.alert(document.documentElement.nextSibling);
-window.alert(document instanceof HTMLDocument);
-window.alert(document instanceof Document);
-var elems = document.getElementsByTagName('div');
-window.alert(elems.length);
-let elem = elems[0];
-window.alert(elem.nodeType);
-window.alert(elem);
-window.alert("==1.5==");
-var rect = elem.getBoundingClientRect();
-window.alert(rect);
-window.alert(rect.top);
-window.alert(rect.bottom);
-window.alert(rect.left);
-window.alert(rect.right);
-window.alert(rect.width);
-window.alert(rect.height);
-window.alert("==2==");
-var rects = elem.getClientRects();
-window.alert("==3==");
-window.alert(rects);
-window.alert(rects.length);
-window.alert("==4==");
-let rect = rects[0];
-window.alert(rect);
-/*window.alert(Object.prototype.toString.call(rect.__proto__));
-window.alert(rect.__proto__ === Object.getPrototypeOf(rect));
-window.alert(rect.__proto__.top);
-window.alert(Object.getPrototypeOf(rect).top);*/
-window.alert(rect.top);
-window.alert(rect.bottom);
-window.alert(rect.left);
-window.alert(rect.right);
-window.alert(rect.width);
-window.alert(rect.height);
-
-window.alert("HTMLCollection:");
-let tags = document.getElementsByTagName("div");
-//let tag = tags[0];
-window.alert(tags);
-window.alert(tags.length);
-window.alert(tags[0]);
-window.alert(tags[0].tagName);
-window.alert(tags[0].getClientRects());
-window.alert(tags[1]);
-window.alert(tags[2]);
-window.alert(tags[3]);
-let tags = document.getElementsByName("test");
-window.alert(tags);
-window.alert(tags.length);
-window.alert(tags[0]);
-window.alert(tags[0].tagName);
-window.alert(tags[1]);
-window.alert(tags[1].tagName);
-window.alert(tags[2]);
-let tags = document.links;
-window.alert(tags);
-window.alert(tags.length);
-window.alert(tags[0]);
-window.alert(tags[0].tagName);
-let tags = document.images;
-window.alert(tags);
-window.alert(tags.length);
-window.alert(tags[0]);
-window.alert(tags[0].tagName);
-let tags = document.embeds;
-window.alert(tags);
-window.alert(tags.length);
-window.alert(tags[0]);
-window.alert(tags[0].tagName);
-let tags = document.plugins;
-window.alert(tags);
-window.alert(tags.length);
-window.alert(tags[0]);
-window.alert(tags[0].tagName);
-let tags = document.forms;
-window.alert(tags);
-window.alert(tags.length);
-window.alert(tags[0]);
-window.alert(tags[0].tagName);
-let tags = document.scripts;
-window.alert(tags);
-window.alert(tags.length);
-window.alert(tags[0]);
-window.alert(tags[0].tagName);
-let tags = document.applets;
-window.alert(tags);
-window.alert(tags.length);
-window.alert(tags[0]);
-window.alert(tags[0].tagName);
-
-window.alert("Document:");
-let head = document.head;
-window.alert(head);
-window.alert(head.tagName);
-
-window.alert("DOMParser:");
-window.alert(DOMParser);
-let parser = new DOMParser();
-window.alert(parser);
-//window.alert(parser.parseFromString("<html></html>", "text/html"));
-
-window.alert("Event:");
-window.alert(Event);
-let ev = new Event("foopy");
-window.alert(ev.type);
-window.alert(ev.defaultPrevented);
-ev.preventDefault();
-window.alert(ev.defaultPrevented);
-
-window.alert("MouseEvent:");
-window.alert(MouseEvent);
-let ev2 = new MouseEvent("press", {bubbles: true, screenX: 150, detail: 100});
-window.alert(ev2);
-window.alert(ev2.screenX);
-window.alert(ev2.detail);
-window.alert(ev2.getModifierState("ctrl"));
-window.alert(ev2 instanceof Event);
-window.alert(ev2 instanceof UIEvent);
-
-window.alert(document.title);
-document.title = "foo";
-window.alert(document.title);
-
-window.alert(document.links[0]);
-window.alert(document.getElementsByTagName('iframe')[0]);
-
-window.alert(document.getElementsByTagName("body")[0]);
-window.alert(document.getElementsByTagName("area")[0]);
-window.alert(document.getElementsByTagName("base")[0]);
-window.alert(document.getElementsByTagName("data")[0]);
-
-window.alert("OList:");
-let tags = document.getElementsByTagName("ol");
-window.alert(tags);
-window.alert(tags.length);
-window.alert(tags[0]);
-window.alert(tags[0].tagName);
-
-window.alert("HTMLElement:");
-let tagList = ["section", "aside", "b", "i", "small"];
-for (let i = 0, l = tagList.length; i < l; ++i) {
- let tags = document.getElementsByTagName(tagList[i]);
- window.alert(tags);
- window.alert(tags.length);
- window.alert(tags[0].tagName);
- window.alert(tags[0] instanceof HTMLElement);
-}
-
-window.alert("HTMLCanvasElement:");
-let tags = document.getElementsByTagName("canvas");
-window.alert(tags);
-window.alert(tags.length);
-window.alert(tags[0].tagName);
-window.alert(tags[0] instanceof HTMLCanvasElement);
-
-window.alert("HTMLSourceElement:");
-let tags = document.getElementsByTagName("source");
-window.alert(tags);
-window.alert(tags.length);
-window.alert(tags[0].tagName);
-window.alert(tags[0] instanceof HTMLSourceElement);
-
-window.alert("HTMLTimeElement:");
-let tags = document.getElementsByTagName("time");
-window.alert(tags);
-window.alert(tags.length);
-window.alert(tags[0].tagName);
-window.alert(tags[0] instanceof HTMLTimeElement);
-
-window.alert("HTMLTableCaptionElement:");
-let tags = document.getElementsByTagName("caption");
-window.alert(tags);
-window.alert(tags.length);
-window.alert(tags[0].tagName);
-window.alert(tags[0] instanceof HTMLTableCaptionElement);
-
-window.alert("HTMLTextAreaElement:");
-let tags = document.getElementsByTagName("textarea");
-window.alert(tags);
-window.alert(tags.length);
-window.alert(tags[0].tagName);
-window.alert(tags[0] instanceof HTMLTextAreaElement);
-
-window.alert("HTMLQuoteElement:");
-let tags = document.getElementsByTagName("q");
-window.alert(tags);
-window.alert(tags.length);
-window.alert(tags[0].tagName);
-window.alert(tags[0] instanceof HTMLQuoteElement);
-
-window.alert("HTMLTableHeaderCellElement:");
-let tags = document.getElementsByTagName("th");
-window.alert(tags);
-window.alert(tags.length);
-window.alert(tags[0].tagName);
-window.alert(tags[0] instanceof HTMLTableCellElement);
-window.alert(tags[0] instanceof HTMLTableHeaderCellElement);
-
-window.alert("HTMLTableDataCellElement:");
-let tags = document.getElementsByTagName("td");
-window.alert(tags);
-window.alert(tags.length);
-window.alert(tags[0].tagName);
-window.alert(tags[0] instanceof HTMLTableCellElement);
-window.alert(tags[0] instanceof HTMLTableDataCellElement);
-
-window.alert("HTMLTableColElement");
-let tagList = ["col", "colgroup"];
-for (let i = 0, l = tagList.length; i < l; ++i) {
- let tags = document.getElementsByTagName(tagList[i]);
- window.alert(tags);
- window.alert(tags.length);
- window.alert(tags[0].tagName);
- window.alert(tags[0] instanceof HTMLTableColElement);
-}
-
-window.alert("HTMLInputElement:");
-let tags = document.getElementsByTagName("input");
-window.alert(tags);
-window.alert(tags.length);
-window.alert(tags[0].tagName);
-window.alert(tags[0] instanceof HTMLInputElement);
-
-window.alert("HTMLLIElement:");
-let tags = document.getElementsByTagName("li");
-window.alert(tags);
-window.alert(tags.length);
-window.alert(tags[0].tagName);
-window.alert(tags[0] instanceof HTMLLLIElement);
-
-window.alert("HTMLProgressElement:");
-let tags = document.getElementsByTagName("progress");
-window.alert(tags);
-window.alert(tags.length);
-window.alert(tags[0].tagName);
-window.alert(tags[0] instanceof HTMLProgressElement);
-
-window.alert("HTMLTemplateElement:");
-let tags = document.getElementsByTagName("template");
-window.alert(tags);
-window.alert(tags.length);
-window.alert(tags[0].tagName);
-window.alert(tags[0] instanceof HTMLTemplateElement);
-
-window.alert("HTMLPreElement:");
-let tags = document.getElementsByTagName("pre");
-window.alert(tags);
-window.alert(tags.length);
-window.alert(tags[0].tagName);
-window.alert(tags[0] instanceof HTMLPreElement);
-
-window.alert("HTMLLegendElement:");
-let tags = document.getElementsByTagName("legend");
-window.alert(tags);
-window.alert(tags.length);
-window.alert(tags[0].tagName);
-window.alert(tags[0] instanceof HTMLLegendElement);
-
-window.alert("HTMLLabelElement:");
-let tags = document.getElementsByTagName("label");
-window.alert(tags);
-window.alert(tags.length);
-window.alert(tags[0].tagName);
-window.alert(tags[0] instanceof HTMLLabelElement);
-
-window.alert("HTMLTrackElement:");
-let tags = document.getElementsByTagName("track");
-window.alert(tags);
-window.alert(tags.length);
-window.alert(tags[0].tagName);
-window.alert(tags[0] instanceof HTMLTrackElement);
-
-window.alert("HTMLAudioElement:");
-let tags = document.getElementsByTagName("audio");
-window.alert(tags);
-window.alert(tags.length);
-window.alert(tags[0].tagName);
-window.alert(tags[0] instanceof HTMLMediaElement);
-window.alert(tags[0] instanceof HTMLAudioElement);
-
-window.alert("HTMLVideoElement:");
-let tags = document.getElementsByTagName("video");
-window.alert(tags);
-window.alert(tags.length);
-window.alert(tags[0].tagName);
-window.alert(tags[0] instanceof HTMLMediaElement);
-window.alert(tags[0] instanceof HTMLVideoElement);
-
-//TODO: Doesn't work until we throw proper exceptions instead of returning 0 on
-// unwrap failure.
-/*try {
- Object.getOwnPropertyDescriptor(Object.getPrototypeOf(rects), "length").get.call(window);
- window.alert("hmm?");
-} catch (x) {
- window.alert("ok");
-}*/
-</script>
- </head>
- <body>
- <div id="first" name="test">fffff<br><br><br><br>fffffffffffffffff</div>
- <div id="second">ggg</div>
- <span id="third" name="test">hhhhhhhh</span>
- <div id="fourth">iiiiiiiiiiiiiiiiiii</div>
- <a href="http://www.mozilla.org"></a>
- <img src="test.jpg"/>
- <embed></embed>
- <form>
- <fieldset>
- <legend>legend</legend>
- <label for="">label<input type="text" value="input" /></label>
- </fieldset>
- </form>
- <hr />
- <canvas/>
- <p>pppppppppp</p>
- <q>qqqqqqqqqqqqqqqqqqqqqqqqqqq</q>
- <progress max="100" value="80">80%</progress>
- <applet></applet>
- <input type="text" value="input"/>
- <iframe></iframe>
- <ol type="1">
- <li>li</li>
- </ol>
- <table>
- <caption>sample table</caption>
- <colgroup>
- <col/>
- </colgroup>
- <tbody>
- <tr><td>head</td></tr>
- <tr><td>data</td></tr>
- </tbody>
- </table>
- <section>section</section>
- <aside>aside</aside>
- <b>b</b>
- <i>i</i>
- <small>small</small>
- <textarea>textarea</textarea>
- <time datetime="2014-02-14">Valentines day</time>
- <audio>
- <source src="horse.ogg" type="audio/ogg">
- <source src="horse.mp3" type="audio/mpeg">
- </audio>
- <area></area>
- <data></data>
- <template></template>
- <pre>pre</pre>
- <video src="">
- <track></track>
- </video>
- </body>
-</html>