Web 用ビルドのテストページです。
{
"str" : "string",
"num" : 1e3,
"nul" : null,
"ary" : [ "string", 255, null, { "0" : 1 }, [] ]
}
/**
* nth element in the fibonacci series.
* @param n >= 0
* @return the nth element, >= 0.
*/
function fib(n) {
var a = 1, b = 1;
var tmp;
while (--n >= 0) {
tmp = a;
a += b;
b = tmp;
}
return a;
}
document.write(fib(10));
/foo/; // a slash starting a line treated as a regexp beginning
"foo".match(/fo+$/);
// this line comment not treated as a regular expressions
"foo /bar/".test(/"baz"/); // test string and regexp boundaries
var division = /\b\d+\/\d+/g; // test char sets and escaping of specials
var allSpecials = /([^\(\)\[\]\{\}\-\?\+\*\.\^\$\/]+)\\/;
var slashInCharset = /[^/]/g, notCloseSq = /[^\]]/;
// test that slash used in numeric context treated as an operator
1 / 2;
1. / x;
x / y;
(x) / y;
1 /* foo */ / 2;
1 /* foo *// 2;
1/2;
1./x;
x/y;
(x)/y;
// test split over two lines. line comment should not fool it
1//
/2;
x++/y;
x--/y;
x[y] / z;
f() / n;
// test that slash after non postfix operator is start of regexp
log('matches = ' + /foo/.test(foo));
// test keyword preceders
return /a regexp/;
division = notreturn / not_a_regexp / 2; // keyword suffix does not match
// & not used as prefix operator in javascript but this should still work
&/foo/;
extends = /extends/;
/foo/; // a slash starting a line treated as a regexp beginning
"foo".match(/fo+$/);
// this line comment not treated as a regular expressions
"foo /bar/".test(/"baz"/); // test string and regexp boundaries
var division = /\b\d+\/\d+/g; // test char sets and escaping of specials
var allSpecials = /([^\(\)\[\]\{\}\-\?\+\*\.\^\$\/]+)\\/;
var slashInCharset = /[^/]/g, notCloseSq = /[^\]]/;
// test that slash used in numeric context treated as an operator
1 / 2;
1. / x;
x / y;
(x) / y;
1 /* foo */ / 2;
1 /* foo *// 2;
1/2;
1./x;
x/y;
(x)/y;
// test split over two lines. line comment should not fool it
1//
/2;
x++/y;
x--/y;
x[y] / z;
f() / n;
// test that slash after non postfix operator is start of regexp
log('matches = ' + /foo/.test(foo));
// test keyword preceders
return /a regexp/;
division = notreturn / not_a_regexp / 2; // keyword suffix does not match
// & not used as prefix operator in javascript but this should still work
&/foo/;
extends = /extends/;
<html>
<head>
<title>Fibonacci number</title>
<style><!-- BODY { text-decoration: blink } --></style>
<script src="foo.js"></script>
<script src="bar.js"></script>
</head>
<body>
<noscript>
<dl>
<dt>Fibonacci numbers</dt>
<dd>1</dd>
<dd>1</dd>
<dd>2</dd>
<dd>3</dd>
<dd>5</dd>
<dd>8</dd>
…
</dl>
</noscript>
<script type="text/javascript"><!--
function fib(n) {
var a = 1, b = 1;
var tmp;
while (--n >= 0) {
tmp = a;
a += b;
b = tmp;
}
return a;
}
document.writeln(fib(10));
// -->
</script>
</body>
</html>
Fibonacci Numbers
<noscript>
<dl style="list-style: disc">
<dt>Fibonacci numbers</dt>
<dd>1</dd>
<dd>1</dd>
<dd>2</dd>
<dd>3</dd>
<dd>5</dd>
<dd>8</dd>
…
</dl>
</noscript>
<script type="text/javascript"><!--
function fib(n) {
var a = 1, b = 1;
var tmp;
while (--n >= 0) {
tmp = a;
a += b;
b = tmp;
}
return a;
}
document.writeln(fib(10));
// -->
</script>
<xhtml>
<head>
<title>Fibonacci number</title>
</head>
<body onload="alert(fib(10))">
<script type="text/javascript"><![CDATA[
function fib(n) {
var a = 1, b = 1;
var tmp;
while (--n >= 0) {
tmp = a;
a += b;
b = tmp;
}
return a;
}
]]>
</script>
</body>
</xhtml>
Issue #4: JavaScript Snippets wrapped in HTML SCRIPT tags hides/destroys inner content
The fact that the script tag was not closed properly was causing PR_splitSourceNodes to end without emitting the script contents.
<script type="text/javascript">
var savedTarget=null; // The target layer (effectively vidPane)
var orgCursor=null; // The original mouse style so we can restore it
var dragOK=false; // True if we're allowed to move the element under mouse
var dragXoffset=0; // How much we've moved the element on the horozontal
var dragYoffset=0; // How much we've moved the element on the verticle
vidPaneID = document.getElementById('vidPane'); // Our movable layer
vidPaneID.style.top='75px'; // Starting location horozontal
vidPaneID.style.left='75px'; // Starting location verticle
<script>
<!--
@charset('UTF-8');
/** A url that is not quoted. */
@import(url(/more-styles.css));
HTML { content-before: 'hello\20'; content-after: 'w\6f rld';
-moz-spiff: inherit !important }
/* Test units on numbers. */
BODY { margin-bottom: 4px; margin-left: 3in; margin-bottom: 0; margin-top: 5% }
/** Test number literals and quoted values. */
TABLE.foo TR.bar A#visited { color: #001123; font-family: "monospace" }
/** bolder is not a name, so should be plain. !IMPORTANT is a keyword
* regardless of case.
*/
blink { text-decoration: BLINK !IMPORTANT; font-weight: bolder }
/* Empty url() was causing infinite recursion */
a { background-image: url(); }
p#featured{background:#fea}
-->
<style type='text/css'>
/* desert scheme ported from vim to google prettify */
code.prettyprint { display: block; padding: 2px; border: 1px solid #888;
background-color: #333; }
.str { color: #ffa0a0; } /* string - pink */
.kwd { color: #f0e68c; font-weight: bold; }
.com { color: #87ceeb; } /* comment - skyblue */
.typ { color: #98fb98; } /* type - lightgreen */
.lit { color: #cd5c5c; } /* literal - darkred */
.pun { color: #fff; } /* punctuation */
.pln { color: #fff; } /* plaintext */
.tag { color: #f0e68c; font-weight: bold; } /* html/xml tag - lightyellow*/
.atn { color: #bdb76b; font-weight: bold; } /* attribute name - khaki*/
.atv { color: #ffa0a0; } /* attribute value - pink */
.dec { color: #98fb98; } /* decimal - lightgreen */
</style>