auto merge of #957 : kmcallister/servo/inline-js, r=jdm

This commit is contained in:
bors-servo 2013-09-19 15:03:52 -07:00
commit 0ca4c19b57
42 changed files with 537 additions and 521 deletions

View file

@ -26,4 +26,4 @@ impl HTMLDataListElement {
let (scope, cx) = self.get_scope_and_cx();
HTMLCollection::new(~[], cx, scope)
}
}
}

View file

@ -26,4 +26,4 @@ impl HTMLHeadingElement {
pub fn SetAlign(&mut self, _align: &DOMString) {
}
}
}

View file

@ -6,7 +6,12 @@
.red { color: red; }
.blue { color: blue; }
</style>
<script src="color-change-text.js"></script>
<script>
window.setTimeout(function () {
window.document.getElementsByTagName('div')[0].setAttribute('class', 'blue');
window.document.getElementsByTagName('div')[1].setAttribute('style', 'color:red;');
}, 1000);
</script>
</head>
<body>
<div id="change" class="red">Hello, World!</div>

View file

@ -1,4 +0,0 @@
window.setTimeout(function () {
window.document.getElementsByTagName('div')[0].setAttribute('class', 'blue');
window.document.getElementsByTagName('div')[1].setAttribute('style', 'color:red;');
}, 1000);

View file

@ -26,4 +26,4 @@ function _test_timed_out() {
}
}
setTimeout(_test_timed_out, _test_timeout);
setTimeout(_test_timed_out, _test_timeout);

View file

@ -1,6 +1,19 @@
<html>
<head>
<script src="harness.js"></script>
<script src="test_empty_clientrect.js"></script>
<script>
var rect = window.document.head.getBoundingClientRect();
var rects = window.document.head.getClientRects();
is(rect instanceof ClientRect, true);
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(rects.length, 0);
finish();
</script>
</head>
</html>

View file

@ -1,12 +0,0 @@
var rect = window.document.head.getBoundingClientRect();
var rects = window.document.head.getClientRects();
is(rect instanceof ClientRect, true);
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(rects.length, 0);
finish();

View file

@ -1,6 +1,13 @@
<html>
<head>
<script src="harness.js"></script>
<script src="test_global.js"></script>
<script>
is(window, window.window);
is(window, this);
for (var key in this) {
is(this[key], window[key]);
}
finish();
</script>
</head>
</html>

View file

@ -1,6 +0,0 @@
is(window, window.window);
is(window, this);
for (var key in this) {
is(this[key], window[key]);
}
finish();

View file

@ -5,6 +5,28 @@
</head>
<body>
<img src="test.png"/>
<script src="test_img_width_height.js"></script>
<script>
// Testing get/set of image width/height properties
var img = window.document.getElementsByTagName("img")[0];
function wait_for_img_load(f) {
if (img.width != 0) {
f();
} else {
window.setTimeout(function() { wait_for_img_load(f) }, 1);
}
}
wait_for_img_load(function() {
is(img.width, 500);
is(img.height, 378);
img.width = 200;
img.height = 100;
is(img.width, 200);
is(img.height, 100);
finish();
});
</script>
</body>
</html>

View file

@ -1,21 +0,0 @@
// Testing get/set of image width/height properties
var img = window.document.getElementsByTagName("img")[0];
function wait_for_img_load(f) {
if (img.width != 0) {
f();
} else {
window.setTimeout(function() { wait_for_img_load(f) }, 1);
}
}
wait_for_img_load(function() {
is(img.width, 500);
is(img.height, 378);
img.width = 200;
img.height = 100;
is(img.width, 200);
is(img.height, 100);
finish();
});

View file

@ -4,6 +4,26 @@
<script src="harness.js"></script>
</head>
<body>
<script src="test_navigator.js"></script>
<script>
is(window.navigator, window.navigator);
is(String(window.navigator), '[object Navigator]');
var nav = window.navigator;
is(nav.doNotTrack, "unspecified");
is(nav.vendor, "");
is(nav.vendorSub, "");
is(nav.product, "Gecko");
is(nav.javaEnabled(), false);
is(nav.taintEnabled(), false);
is(nav.appName, "Netscape");
is(nav.appCodeName, "Mozilla");
// todo
is(nav.appVersion, null);
is(nav.platform, null);
is(nav.userAgent, null);
is(nav.language, null);
is(nav.onLine, true);
finish();
</script>
</body>
</html>

View file

@ -1,19 +0,0 @@
is(window.navigator, window.navigator);
is(String(window.navigator), '[object Navigator]');
var nav = window.navigator;
is(nav.doNotTrack, "unspecified");
is(nav.vendor, "");
is(nav.vendorSub, "");
is(nav.product, "Gecko");
is(nav.javaEnabled(), false);
is(nav.taintEnabled(), false);
is(nav.appName, "Netscape");
is(nav.appCodeName, "Mozilla");
// todo
is(nav.appVersion, null);
is(nav.platform, null);
is(nav.userAgent, null);
is(nav.language, null);
is(nav.onLine, true);
finish();

View file

@ -4,6 +4,17 @@
</head>
<body>
<foo-á>foo</foo-á>
<script src="test_prototypes.js"></script>
<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(window.document.documentElement.tagName, "HTML");
is(window.document.getElementsByTagName('foo-á')[0] instanceof HTMLUnknownElement, true);
is(window.document.getElementsByTagName('foo-á')[0].tagName, "FOO-á");
finish();
</script>
</body>
</html>

View file

@ -1,10 +0,0 @@
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(window.document.documentElement.tagName, "HTML");
is(window.document.getElementsByTagName('foo-á')[0] instanceof HTMLUnknownElement, true);
is(window.document.getElementsByTagName('foo-á')[0].tagName, "FOO-á");
finish();

View file

@ -4,6 +4,11 @@
<script src="harness.js"></script>
</head>
<body>
<script src="test_proxy_setter.js"></script>
<script>
is(window.document.title, '');
window.document.title = 'foo';
is(window.document.title, 'foo');
finish();
</script>
</body>
</html>

View file

@ -1,4 +0,0 @@
is(window.document.title, '');
window.document.title = 'foo';
is(window.document.title, 'foo');
finish();

View file

@ -8,6 +8,31 @@
<p><img src="longcattop.png"/></p>
<p><img src="longcatmid.png"/></p>
<p><img src="longcatbot.png"/></p>
<script src="longcat.js"></script>
<script>
var longcats = window.document.getElementsByTagName("img");
var longcat_top = longcats[0];
var longcat_mid = longcats[1];
var longcat_bot = longcats[2];
function wait_for_img_load(f) {
if (longcat_top.width != 0 && longcat_mid.width != 0 && longcat_bot.width != 0) {
f();
} else {
window.setTimeout(function() { wait_for_img_load(f) }, 1);
}
}
wait_for_img_load(function() {
var count = 0;
function elongate() {
var height = Math.round((Math.cos(count + Math.PI) + 1) * 100 + 20);
count += 0.2;
longcat_mid.height = height;
longcat_mid.width = 600;
window.setTimeout(function() { elongate() }, 50);
}
elongate();
});
</script>
</body>
</html>

View file

@ -1,24 +0,0 @@
var longcats = window.document.getElementsByTagName("img");
var longcat_top = longcats[0];
var longcat_mid = longcats[1];
var longcat_bot = longcats[2];
function wait_for_img_load(f) {
if (longcat_top.width != 0 && longcat_mid.width != 0 && longcat_bot.width != 0) {
f();
} else {
window.setTimeout(function() { wait_for_img_load(f) }, 1);
}
}
wait_for_img_load(function() {
var count = 0;
function elongate() {
var height = Math.round((Math.cos(count + Math.PI) + 1) * 100 + 20);
count += 0.2;
longcat_mid.height = height;
longcat_mid.width = 600;
window.setTimeout(function() { elongate() }, 50);
}
elongate();
});

View file

@ -45,4 +45,4 @@ q:before, q:after {
table {
border-collapse: collapse;
border-spacing: 0;
}
}

View file

@ -1 +1 @@
body { margin: 0px }
body { margin: 0px }

View file

@ -4,4 +4,4 @@ img {
left: 100px;
border-width: 10px;
border-color: blue
}
}

View file

@ -1,8 +0,0 @@
function output (text)
{
window.alert(text);
}
output("Opossums have pouches like kangaroos");

View file

@ -1 +1,8 @@
<script src="test-alert.js"></script>
<script>
function output (text)
{
window.alert(text);
}
output("Opossums have pouches like kangaroos");
</script>

View file

@ -1,3 +1,20 @@
<img src="test.jpeg" width="50" height="378"/>
<script src="test_image_getter.js"></script>
<script>
function setWidth(w, i) {
elem.width = w;
window.alert(elem.width);
w += i;
if (w == 0 || w == 1000)
i *= -1;
window.setTimeout(function() { setWidth(w, i); }, 50);
}
var elem = window.document.documentElement.firstChild.firstChild.nextSibling.firstChild;
window.alert(elem.tagName);
window.alert(elem instanceof HTMLImageElement);
window.alert(elem instanceof HTMLElement);
window.alert(elem instanceof Element);
window.alert(elem.width);
setWidth(1000, -10);
</script>

View file

@ -4,4 +4,22 @@
<img></img><img></img><img></img>
</div>
</div>
<script src="test_docelem.js"></script>
<script>
debug("hi");
var elem = document.documentElement;
debug("document.documentElement: " + elem);
debug("Document: " + Document);
debug("Node: " + Node);
debug("Document instanceof Node: " + (Document instanceof Node));
debug("elem instanceof Node: " + (elem instanceof Node));
debug("elem instanceof Document: " + (elem instanceof Document));
debug("document instanceof Document: " + (document instanceof Document));
debug("document instanceof Node: " + (document instanceof Node));
debug("elem.tagName: " + elem.tagName);
debug("elem.firstChild: " + elem.firstChild);
debug("elem.firstChild.tagName: " + elem.firstChild.tagName);
debug("elem.firstChild.nextSibling: " + elem.firstChild.nextSibling);
debug("elem.firstChild.nextSibling.tagName: " + elem.firstChild.nextSibling.tagName);
debug("elem.nextSibling: " + elem.nextSibling);
debug("elem.nextSibling.tagName: " + elem.nextSibling.tagName);
</script>

View file

@ -1,3 +1,3 @@
div {
background-color: blue;
}
}

View file

@ -5,7 +5,310 @@
<title>test_binding
page </title>
<base href="./"></base>
<script src="test_bindings.js"></script>
<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("HTMLTableCellElement:");
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("HTMLTableCellElement:");
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("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>

View file

@ -1,302 +0,0 @@
//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("HTMLTableCellElement:");
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("HTMLTableCellElement:");
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("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");
}*/

View file

@ -1,3 +1,5 @@
<html>
<script src="test_close.js"></script>
<script>
window.setTimeout(function() { window.close(); }, 3000);
</script>
</html>

View file

@ -1 +0,0 @@
window.setTimeout(function() { window.close(); }, 3000);

View file

@ -1,17 +0,0 @@
debug("hi");
var elem = document.documentElement;
debug("document.documentElement: " + elem);
debug("Document: " + Document);
debug("Node: " + Node);
debug("Document instanceof Node: " + (Document instanceof Node));
debug("elem instanceof Node: " + (elem instanceof Node));
debug("elem instanceof Document: " + (elem instanceof Document));
debug("document instanceof Document: " + (document instanceof Document));
debug("document instanceof Node: " + (document instanceof Node));
debug("elem.tagName: " + elem.tagName);
debug("elem.firstChild: " + elem.firstChild);
debug("elem.firstChild.tagName: " + elem.firstChild.tagName);
debug("elem.firstChild.nextSibling: " + elem.firstChild.nextSibling);
debug("elem.firstChild.nextSibling.tagName: " + elem.firstChild.nextSibling.tagName);
debug("elem.nextSibling: " + elem.nextSibling);
debug("elem.nextSibling.tagName: " + elem.nextSibling.tagName);

View file

@ -1,2 +1,17 @@
<div></div>
<script src="test_getter_time.js"></script>
<script>
var elem = document.documentElement.firstChild;
var start = new Date()
var count = 1000000;
for (var i = 0; i < count; i++) {
var a = elem.nodeType;
}
var stop = new Date()
window.alert((stop - start) / count * 1e6);
/*start = new Date().getTime();
for (i = 0; i < 10000; i++)
elem.width = i;
window.alert(new Date().getTime() - start);*/
</script>

View file

@ -1,14 +0,0 @@
var elem = document.documentElement.firstChild;
var start = new Date()
var count = 1000000;
for (var i = 0; i < count; i++) {
var a = elem.nodeType;
}
var stop = new Date()
window.alert((stop - start) / count * 1e6);
/*start = new Date().getTime();
for (i = 0; i < 10000; i++)
elem.width = i;
window.alert(new Date().getTime() - start);*/

View file

@ -1,3 +1,3 @@
#styled {
color: red;
}
}

View file

@ -1,7 +1,20 @@
<html>
<head>
<link rel="stylesheet" href="test_hammer_layout.css">
<script src="test_hammer_layout.js"></script>
<script>
var divs = window.document.getElementsByTagName("div");
var div = divs[0];
var count = 1000000;
var start = new Date();
for (var i = 0; i < count; i++) {
div.setAttribute('id', 'styled');
//div.getBoundingClientRect();
}
var stop = new Date();
window.alert((stop - start) / count * 1e6);
window.close();
</script>
</head>
<body>
<div id="">This text is unstyled.</div>

View file

@ -1,12 +0,0 @@
var divs = window.document.getElementsByTagName("div");
var div = divs[0];
var count = 1000000;
var start = new Date();
for (var i = 0; i < count; i++) {
div.setAttribute('id', 'styled');
//div.getBoundingClientRect();
}
var stop = new Date();
window.alert((stop - start) / count * 1e6);
window.close();

View file

@ -1,16 +0,0 @@
function setWidth(w, i) {
elem.width = w;
window.alert(elem.width);
w += i;
if (w == 0 || w == 1000)
i *= -1;
window.setTimeout(function() { setWidth(w, i); }, 50);
}
var elem = window.document.documentElement.firstChild.firstChild.nextSibling.firstChild;
window.alert(elem.tagName);
window.alert(elem instanceof HTMLImageElement);
window.alert(elem instanceof HTMLElement);
window.alert(elem instanceof Element);
window.alert(elem.width);
setWidth(1000, -10);

View file

@ -3,5 +3,22 @@
<head>
<link rel="stylesheet" href="test_slam_layout.css">
</head>
<body><div id="ohhi"></div></body><script src="test_slam_layout.js"></script>
<body><div id="ohhi"></div></body>
<script>
var divs = document.getElementsByTagName("div");
var div = divs[0];
var count = 1000;
var start = new Date();
for (var i = 0; i < count; i++) {
if (i % 2 == 0)
div.setAttribute('id', 'ohhi');
else
div.setAttribute('id', 'mark');
div.getBoundingClientRect();
}
var stop = new Date();
window.alert((stop - start) / count * 1e6 + " ns/layout");
window.close();
</script>
</html>

View file

@ -1,15 +0,0 @@
var divs = document.getElementsByTagName("div");
var div = divs[0];
var count = 1000;
var start = new Date();
for (var i = 0; i < count; i++) {
if (i % 2 == 0)
div.setAttribute('id', 'ohhi');
else
div.setAttribute('id', 'mark');
div.getBoundingClientRect();
}
var stop = new Date();
window.alert((stop - start) / count * 1e6 + " ns/layout");
window.close();

View file

@ -1 +1,13 @@
<div></div><script src="test_timeout.js"></script>
<div></div><script>
function foo(i) {
window.alert("timeout " + i);
if (i == 10)
window.alert("timeouts finished");
else
window.setTimeout(function() { foo(i + 1); }, 1000);
}
window.alert("beginning timeouts");
window.setTimeout(function() { foo(0); }, 1000);
window.alert("timeouts begun");
</script>

View file

@ -1,11 +0,0 @@
function foo(i) {
window.alert("timeout " + i);
if (i == 10)
window.alert("timeouts finished");
else
window.setTimeout(function() { foo(i + 1); }, 1000);
}
window.alert("beginning timeouts");
window.setTimeout(function() { foo(0); }, 1000);
window.alert("timeouts begun");