browser/devtools/webconsole/test/test-console-output-04.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html dir="ltr" lang="en-US">
michael@0 3 <head>
michael@0 4 <meta charset="utf-8">
michael@0 5 <title>Test the web console output - 04</title>
michael@0 6 <!--
michael@0 7 - Any copyright is dedicated to the Public Domain.
michael@0 8 - http://creativecommons.org/publicdomain/zero/1.0/
michael@0 9 -->
michael@0 10 </head>
michael@0 11 <body>
michael@0 12 <p>hello world!</p>
michael@0 13 <script type="text/javascript">
michael@0 14 function testTextNode() {
michael@0 15 return document.querySelector("p").childNodes[0];
michael@0 16 }
michael@0 17
michael@0 18 function testCommentNode() {
michael@0 19 return document.head.childNodes[5];
michael@0 20 }
michael@0 21
michael@0 22 function testDocumentFragment() {
michael@0 23 var frag = document.createDocumentFragment();
michael@0 24
michael@0 25 var div = document.createElement("div");
michael@0 26 div.id = "foo1";
michael@0 27 div.className = "bar";
michael@0 28 frag.appendChild(div);
michael@0 29
michael@0 30 var span = document.createElement("span");
michael@0 31 span.id = "foo2";
michael@0 32 span.textContent = "hello world";
michael@0 33 div.appendChild(span);
michael@0 34
michael@0 35 var div2 = document.createElement("div");
michael@0 36 div2.id = "foo3";
michael@0 37 frag.appendChild(div2);
michael@0 38
michael@0 39 return frag;
michael@0 40 }
michael@0 41
michael@0 42 function testError() {
michael@0 43 try {
michael@0 44 window.foobar("a");
michael@0 45 } catch (ex) {
michael@0 46 return ex;
michael@0 47 }
michael@0 48 return null;
michael@0 49 }
michael@0 50
michael@0 51 function testDOMException() {
michael@0 52 try {
michael@0 53 var foo = document.querySelector("foo;()bar!");
michael@0 54 } catch (ex) {
michael@0 55 return ex;
michael@0 56 }
michael@0 57 return null;
michael@0 58 }
michael@0 59
michael@0 60 function testCSSStyleDeclaration() {
michael@0 61 document.body.style = 'color: green; font-size: 2em';
michael@0 62 return document.body.style;
michael@0 63 }
michael@0 64
michael@0 65 function testStyleSheetList() {
michael@0 66 var style = document.querySelector("style");
michael@0 67 if (!style) {
michael@0 68 style = document.createElement("style");
michael@0 69 style.textContent = "p, div { color: blue; font-weight: bold }\n" +
michael@0 70 "@media print { p { background-color: yellow } }";
michael@0 71 document.head.appendChild(style);
michael@0 72 }
michael@0 73 return document.styleSheets;
michael@0 74 }
michael@0 75 </script>
michael@0 76 </body>
michael@0 77 </html>

mercurial