|
1 <!DOCTYPE HTML> |
|
2 <html dir="ltr" lang="en-US"> |
|
3 <head> |
|
4 <meta charset="utf-8"> |
|
5 <title>Test the web console output - 05</title> |
|
6 <!-- |
|
7 - Any copyright is dedicated to the Public Domain. |
|
8 - http://creativecommons.org/publicdomain/zero/1.0/ |
|
9 --> |
|
10 </head> |
|
11 <body class="body-class" id="body-id"> |
|
12 <p some-attribute="some-value">hello world!</p> |
|
13 <iframe src="data:text/html,<p>hello from iframe</p>"></iframe> |
|
14 <div class="some classname here with more classnames here"></div> |
|
15 <script type="text/javascript"> |
|
16 function testBodyNode() { |
|
17 return document.body; |
|
18 } |
|
19 |
|
20 function testDocumentElement() { |
|
21 return document.documentElement; |
|
22 } |
|
23 |
|
24 function testDocument() { |
|
25 return document; |
|
26 } |
|
27 |
|
28 function testNode() { |
|
29 return document.querySelector("p"); |
|
30 } |
|
31 |
|
32 function testNodeList() { |
|
33 return document.querySelectorAll("*"); |
|
34 } |
|
35 |
|
36 function testNodeInIframe() { |
|
37 return document.querySelector("iframe").contentWindow.document.querySelector("p"); |
|
38 } |
|
39 |
|
40 function testDocumentFragment() { |
|
41 var frag = document.createDocumentFragment(); |
|
42 |
|
43 var span = document.createElement("span"); |
|
44 span.className = 'foo'; |
|
45 span.dataset.lolz = 'hehe'; |
|
46 |
|
47 var div = document.createElement('div') |
|
48 div.id = 'fragdiv'; |
|
49 |
|
50 frag.appendChild(span); |
|
51 frag.appendChild(div); |
|
52 |
|
53 return frag; |
|
54 } |
|
55 |
|
56 function testNodeInDocumentFragment() { |
|
57 var frag = testDocumentFragment(); |
|
58 return frag.firstChild; |
|
59 } |
|
60 |
|
61 function testUnattachedNode() { |
|
62 var p = document.createElement("p"); |
|
63 p.className = "such-class"; |
|
64 p.dataset.data = "such-data"; |
|
65 return p; |
|
66 } |
|
67 </script> |
|
68 </body> |
|
69 </html> |