mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-22 12:12:35 +03:00
simple script tests
This commit is contained in:
parent
72fe92d9ca
commit
f207f14be1
34
test/js/assorted.html
Normal file
34
test/js/assorted.html
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<html>
|
||||||
|
<head><title>moo</title></head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
var tree = (this ===window)
|
||||||
|
console.log(tree);
|
||||||
|
var string = "50";
|
||||||
|
|
||||||
|
console.log(string + 100); // 50100
|
||||||
|
console.log(+string + 100); // 150
|
||||||
|
|
||||||
|
string = parseInt(string, 10);
|
||||||
|
console.log(string + 100); // 150
|
||||||
|
var binary = parseInt("110010", 2);
|
||||||
|
console.log(binary); // 50
|
||||||
|
|
||||||
|
function doSomething(param) {
|
||||||
|
param = param.toUpperCase(); // param is now a local variable
|
||||||
|
console.log(param);
|
||||||
|
}
|
||||||
|
var string = "test";
|
||||||
|
|
||||||
|
/* note that string will be passed in by reference */
|
||||||
|
doSomething(string); // TEST
|
||||||
|
console.log(string); // test
|
||||||
|
|
||||||
|
document.write("<p>Hello World!<p>");
|
||||||
|
</script>
|
||||||
|
<p>one</p>
|
||||||
|
<script>document.write("<scr" +"ipt>document.write(\"Goodbye Cruel World\");</scri" + "pt>");</script>
|
||||||
|
</script>
|
||||||
|
<p>hi</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
17
test/js/index.html
Normal file
17
test/js/index.html
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Script Tests</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="tst.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Script Tests</h1>
|
||||||
|
<ul>
|
||||||
|
<li><a href="assorted.html">Assorted</a></li>
|
||||||
|
<li><a href="inline-doc-write-simple.html">Simple docuemnt write</a></li>
|
||||||
|
<li><a href="inline-doc-write.html">Script within inline script</a></li>
|
||||||
|
<li><a href="sync-script.html">External syncronous script (with css)</a></li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</body>
|
||||||
|
</html>
|
11
test/js/inline-doc-write-simple.html
Normal file
11
test/js/inline-doc-write-simple.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<html>
|
||||||
|
<head><title>Inline Script Simple Document Write</title></head>
|
||||||
|
<body>
|
||||||
|
<h1>Inline Script Simple Document Write</h1>
|
||||||
|
<p>Before</p>
|
||||||
|
<script>
|
||||||
|
document.write("<p>Hello World!<p>");
|
||||||
|
</script>
|
||||||
|
<p>Afterwards</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
13
test/js/inline-doc-write.html
Normal file
13
test/js/inline-doc-write.html
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Inline Docuemnt Write Test</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="tst.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Inline Document Write Test</h1>
|
||||||
|
<p>Before</p>
|
||||||
|
<script>document.write("<scr" +"ipt>document.write(\"Goodbye Cruel World\");</scri" + "pt>");</script>
|
||||||
|
</script>
|
||||||
|
<p>Afterwards</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
12
test/js/sync-script.html
Normal file
12
test/js/sync-script.html
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Sync script Test</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="tst.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Sync script Test</h1>
|
||||||
|
<p>Before</p>
|
||||||
|
<script src="tst.js"></script>
|
||||||
|
<p>Afterwards</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
1
test/js/tst.css
Normal file
1
test/js/tst.css
Normal file
@ -0,0 +1 @@
|
|||||||
|
h1 { color:red; }
|
1
test/js/tst.js
Normal file
1
test/js/tst.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
document.write("<script>document.write(\"Hello World\");</script>");
|
Loading…
Reference in New Issue
Block a user