Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
85 lines (83 sloc) 2.23 KB
<script>
traceBuf="";
ind="";
function s(v) {
if (typeof v=="function") {
if (v.name) return v.name;
v=(""+v).split(/\r?\n/)[0];
} else if (typeof v=="string") {
v=v.replace(/\n/g,"\\n");
v=v.replace(/</g,"&lt;");
v=v.replace(/>/g,"&gt;");
} else {
v=v+"";
}
v=v.substr(0,100);
return v;
}
function _debug(str) {
traceBuf+=ind+"[Debug]"+s(str)+"\n";
}
</script>
<script src="jslint.js"></script>
<pre id="testprog" class="prog"><!--
var $,t;
var a = <span name={ $.test(3) } id='test' >
<body bgcolor="red">
<div>test is {$.a()} !!</div> </body>
</span>;
--></pre>
<pre id="testprog2" class="prog"><!--
var $,t;
var a = <div name={ $.test(3) } id='test' >
{$.template(function (e) {
return <span>{e}</span>;
})}
</div>;
--></pre>
<pre id="testprog3" class="prog"><!--
var $,t;
var a = <div name={ $.test(3) } id='test' >
{$.template(function (e) {
return <>
<span>{e}&nbsp;</span>
<font color="red">{e}</font>
</>;
})}
</div>;
--></pre>
<pre id="testprog4" class="prog"><!--
var $,prototype;
var a=<html>
<script>aaa</script>
<input name="test"/>
</html>;
--></pre>
<pre id="testprog5" class="prog"><!--
var $=<input type="hidden" name="assignment" value={this} /> ;
--></pre>
<pre id="testprog6" class="prog"><!--
var baka="<script>alert('test')</script>";
var cl='">test</a>';
--></pre>
<pre id="testprog7" class="prog"><!--
var a=<span/>;
--></pre>
<script>
//var r=JSLINT("{a:3};");
traceBuf="";
var tests=document.getElementsByClassName("prog");
for (var j=0 ; j<tests.length ; j++) {
var t=tests[j];
_debug("Testing "+t.id);
t=t.innerHTML;
t=t.replace(/^<!--/,"").replace(/-->$/,"");
var r=JSLINT(t,{e4x:true, white:true,sloppy:true});
_debug("JSLint result="+r);
for (var i in JSLINT.errors) {
var e=JSLINT.errors[i];
if (e) _debug(e.reason+" - "+e.line+":"+e.character);
}
}
document.writeln("<pre rows=160 cols=60>"+traceBuf+"</pre>");
</script>
Something went wrong with that request. Please try again.