diff options
Diffstat (limited to 'src')
42 files changed, 537 insertions, 521 deletions
diff --git a/src/components/script/dom/htmldatalistelement.rs b/src/components/script/dom/htmldatalistelement.rs index 1f045028859..68f2b721eed 100644 --- a/src/components/script/dom/htmldatalistelement.rs +++ b/src/components/script/dom/htmldatalistelement.rs @@ -26,4 +26,4 @@ impl HTMLDataListElement { let (scope, cx) = self.get_scope_and_cx(); HTMLCollection::new(~[], cx, scope) } -}
\ No newline at end of file +} diff --git a/src/components/script/dom/htmlheadingelement.rs b/src/components/script/dom/htmlheadingelement.rs index 33231737bb7..c7d107ee20a 100644 --- a/src/components/script/dom/htmlheadingelement.rs +++ b/src/components/script/dom/htmlheadingelement.rs @@ -26,4 +26,4 @@ impl HTMLHeadingElement { pub fn SetAlign(&mut self, _align: &DOMString) { } -}
\ No newline at end of file +} diff --git a/src/test/html/color-change-text.html b/src/test/html/color-change-text.html index 12a8a5a4581..261552d667a 100644 --- a/src/test/html/color-change-text.html +++ b/src/test/html/color-change-text.html @@ -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> diff --git a/src/test/html/color-change-text.js b/src/test/html/color-change-text.js deleted file mode 100644 index a8923d34c9a..00000000000 --- a/src/test/html/color-change-text.js +++ /dev/null @@ -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); diff --git a/src/test/html/content/harness.js b/src/test/html/content/harness.js index add82ab9910..d2a44a15be9 100644 --- a/src/test/html/content/harness.js +++ b/src/test/html/content/harness.js @@ -26,4 +26,4 @@ function _test_timed_out() { } } -setTimeout(_test_timed_out, _test_timeout);
\ No newline at end of file +setTimeout(_test_timed_out, _test_timeout); diff --git a/src/test/html/content/test_empty_clientrect.html b/src/test/html/content/test_empty_clientrect.html index ecefe14a3fd..3902886ee99 100644 --- a/src/test/html/content/test_empty_clientrect.html +++ b/src/test/html/content/test_empty_clientrect.html @@ -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> diff --git a/src/test/html/content/test_empty_clientrect.js b/src/test/html/content/test_empty_clientrect.js deleted file mode 100644 index d46dbafc664..00000000000 --- a/src/test/html/content/test_empty_clientrect.js +++ /dev/null @@ -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();
\ No newline at end of file diff --git a/src/test/html/content/test_global.html b/src/test/html/content/test_global.html index c75ba555e66..24cfbc5f6ba 100644 --- a/src/test/html/content/test_global.html +++ b/src/test/html/content/test_global.html @@ -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> diff --git a/src/test/html/content/test_global.js b/src/test/html/content/test_global.js deleted file mode 100644 index d6d84a8d474..00000000000 --- a/src/test/html/content/test_global.js +++ /dev/null @@ -1,6 +0,0 @@ -is(window, window.window); -is(window, this); -for (var key in this) { - is(this[key], window[key]); -} -finish();
\ No newline at end of file diff --git a/src/test/html/content/test_img_width_height.html b/src/test/html/content/test_img_width_height.html index b61fa1aab06..b748db924f5 100644 --- a/src/test/html/content/test_img_width_height.html +++ b/src/test/html/content/test_img_width_height.html @@ -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> diff --git a/src/test/html/content/test_img_width_height.js b/src/test/html/content/test_img_width_height.js deleted file mode 100644 index cb1a076113a..00000000000 --- a/src/test/html/content/test_img_width_height.js +++ /dev/null @@ -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(); -}); diff --git a/src/test/html/content/test_navigator.html b/src/test/html/content/test_navigator.html index 5e68d2608fe..7d786ea8ec6 100644 --- a/src/test/html/content/test_navigator.html +++ b/src/test/html/content/test_navigator.html @@ -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> diff --git a/src/test/html/content/test_navigator.js b/src/test/html/content/test_navigator.js deleted file mode 100644 index 7e343d40394..00000000000 --- a/src/test/html/content/test_navigator.js +++ /dev/null @@ -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();
\ No newline at end of file diff --git a/src/test/html/content/test_prototypes.html b/src/test/html/content/test_prototypes.html index 5467caf52a8..9eb3e878e31 100644 --- a/src/test/html/content/test_prototypes.html +++ b/src/test/html/content/test_prototypes.html @@ -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> diff --git a/src/test/html/content/test_prototypes.js b/src/test/html/content/test_prototypes.js deleted file mode 100644 index 9eea42be4b6..00000000000 --- a/src/test/html/content/test_prototypes.js +++ /dev/null @@ -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(); diff --git a/src/test/html/content/test_proxy_setter.html b/src/test/html/content/test_proxy_setter.html index ed096bf5b3c..0d18f111599 100644 --- a/src/test/html/content/test_proxy_setter.html +++ b/src/test/html/content/test_proxy_setter.html @@ -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> diff --git a/src/test/html/content/test_proxy_setter.js b/src/test/html/content/test_proxy_setter.js deleted file mode 100644 index 67f4585c15a..00000000000 --- a/src/test/html/content/test_proxy_setter.js +++ /dev/null @@ -1,4 +0,0 @@ -is(window.document.title, ''); -window.document.title = 'foo'; -is(window.document.title, 'foo'); -finish();
\ No newline at end of file diff --git a/src/test/html/longcat.html b/src/test/html/longcat.html index 612a1dac758..68c86843415 100644 --- a/src/test/html/longcat.html +++ b/src/test/html/longcat.html @@ -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> diff --git a/src/test/html/longcat.js b/src/test/html/longcat.js deleted file mode 100644 index 0e3a0991fa4..00000000000 --- a/src/test/html/longcat.js +++ /dev/null @@ -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(); -}); diff --git a/src/test/html/ref/reset.css b/src/test/html/ref/reset.css index 9ff51ebbb38..e5156472701 100644 --- a/src/test/html/ref/reset.css +++ b/src/test/html/ref/reset.css @@ -45,4 +45,4 @@ q:before, q:after { table { border-collapse: collapse; border-spacing: 0; -}
\ No newline at end of file +} diff --git a/src/test/html/ref/simple-reset.css b/src/test/html/ref/simple-reset.css index 310d9a70a0e..09f51257adc 100644 --- a/src/test/html/ref/simple-reset.css +++ b/src/test/html/ref/simple-reset.css @@ -1 +1 @@ -body { margin: 0px }
\ No newline at end of file +body { margin: 0px } diff --git a/src/test/html/test-absolute.css b/src/test/html/test-absolute.css index c4391fcf9bd..0929875f918 100644 --- a/src/test/html/test-absolute.css +++ b/src/test/html/test-absolute.css @@ -4,4 +4,4 @@ img { left: 100px; border-width: 10px; border-color: blue -}
\ No newline at end of file +} diff --git a/src/test/html/test-alert.js b/src/test/html/test-alert.js deleted file mode 100644 index a8ea7ab24b9..00000000000 --- a/src/test/html/test-alert.js +++ /dev/null @@ -1,8 +0,0 @@ -function output (text) -{ - window.alert(text); -} - -output("Opossums have pouches like kangaroos"); - - diff --git a/src/test/html/test-js-alert.html b/src/test/html/test-js-alert.html index 9d875b04249..6e00389b059 100644 --- a/src/test/html/test-js-alert.html +++ b/src/test/html/test-js-alert.html @@ -1 +1,8 @@ -<script src="test-alert.js"></script> +<script> +function output (text) +{ + window.alert(text); +} + +output("Opossums have pouches like kangaroos"); +</script> diff --git a/src/test/html/test-js-image.html b/src/test/html/test-js-image.html index 4d899bb9e21..96c755510d1 100644 --- a/src/test/html/test-js-image.html +++ b/src/test/html/test-js-image.html @@ -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> diff --git a/src/test/html/test-js.html b/src/test/html/test-js.html index a810121d91f..40f94281e07 100644 --- a/src/test/html/test-js.html +++ b/src/test/html/test-js.html @@ -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> diff --git a/src/test/html/test_bg_color_simple.css b/src/test/html/test_bg_color_simple.css index 6083263c93e..973174e7474 100644 --- a/src/test/html/test_bg_color_simple.css +++ b/src/test/html/test_bg_color_simple.css @@ -1,3 +1,3 @@ div { background-color: blue; -}
\ No newline at end of file +} diff --git a/src/test/html/test_bindings.html b/src/test/html/test_bindings.html index 8223a225180..f41cff19df1 100644 --- a/src/test/html/test_bindings.html +++ b/src/test/html/test_bindings.html @@ -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> diff --git a/src/test/html/test_bindings.js b/src/test/html/test_bindings.js deleted file mode 100644 index b65ee83eca0..00000000000 --- a/src/test/html/test_bindings.js +++ /dev/null @@ -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"); -}*/ diff --git a/src/test/html/test_close.html b/src/test/html/test_close.html index f4c8b185d0d..7e4fb2a8cb2 100644 --- a/src/test/html/test_close.html +++ b/src/test/html/test_close.html @@ -1,3 +1,5 @@ <html> -<script src="test_close.js"></script> +<script> +window.setTimeout(function() { window.close(); }, 3000); +</script> </html> diff --git a/src/test/html/test_close.js b/src/test/html/test_close.js deleted file mode 100644 index 0f1640bab56..00000000000 --- a/src/test/html/test_close.js +++ /dev/null @@ -1 +0,0 @@ -window.setTimeout(function() { window.close(); }, 3000);
\ No newline at end of file diff --git a/src/test/html/test_docelem.js b/src/test/html/test_docelem.js deleted file mode 100644 index 18594a4bed7..00000000000 --- a/src/test/html/test_docelem.js +++ /dev/null @@ -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);
\ No newline at end of file diff --git a/src/test/html/test_getter_time.html b/src/test/html/test_getter_time.html index 733f78e91b5..da183557820 100644 --- a/src/test/html/test_getter_time.html +++ b/src/test/html/test_getter_time.html @@ -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> diff --git a/src/test/html/test_getter_time.js b/src/test/html/test_getter_time.js deleted file mode 100644 index afe04e8d103..00000000000 --- a/src/test/html/test_getter_time.js +++ /dev/null @@ -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);*/ diff --git a/src/test/html/test_hammer_layout.css b/src/test/html/test_hammer_layout.css index 8218b9cab7d..ba3802d5b75 100644 --- a/src/test/html/test_hammer_layout.css +++ b/src/test/html/test_hammer_layout.css @@ -1,3 +1,3 @@ #styled { color: red; -}
\ No newline at end of file +} diff --git a/src/test/html/test_hammer_layout.html b/src/test/html/test_hammer_layout.html index 119d67a1796..613450e8fd9 100644 --- a/src/test/html/test_hammer_layout.html +++ b/src/test/html/test_hammer_layout.html @@ -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> diff --git a/src/test/html/test_hammer_layout.js b/src/test/html/test_hammer_layout.js deleted file mode 100644 index 369ace01197..00000000000 --- a/src/test/html/test_hammer_layout.js +++ /dev/null @@ -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();
\ No newline at end of file diff --git a/src/test/html/test_image_getter.js b/src/test/html/test_image_getter.js deleted file mode 100644 index 40ea9b11d5e..00000000000 --- a/src/test/html/test_image_getter.js +++ /dev/null @@ -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);
\ No newline at end of file diff --git a/src/test/html/test_slam_layout.html b/src/test/html/test_slam_layout.html index 55adc8109b0..49a62263d0a 100644 --- a/src/test/html/test_slam_layout.html +++ b/src/test/html/test_slam_layout.html @@ -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> diff --git a/src/test/html/test_slam_layout.js b/src/test/html/test_slam_layout.js deleted file mode 100644 index 7149fba8044..00000000000 --- a/src/test/html/test_slam_layout.js +++ /dev/null @@ -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(); diff --git a/src/test/html/test_timeout.html b/src/test/html/test_timeout.html index a06832f07a1..0ae706f67a7 100644 --- a/src/test/html/test_timeout.html +++ b/src/test/html/test_timeout.html @@ -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> diff --git a/src/test/html/test_timeout.js b/src/test/html/test_timeout.js deleted file mode 100644 index f3383744d09..00000000000 --- a/src/test/html/test_timeout.js +++ /dev/null @@ -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");
\ No newline at end of file |