Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 832c9cb23c
Fetching contributors…

Cannot retrieve contributors at this time

65 lines (49 sloc) 1.588 kb
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>CSS TokenStream Demo</title>
<script type="text/javascript" src="../../build/parserlib.js"></script>
</head>
<body>
<h1>CSS TokenStream Demo</h1>
<textarea rows="10" cols="40" id="input">
@charset "UTF-8";
@import url("booya.css") print,screen;
@import "whatup.css" screen;
@import "wicked.css";
@page :first {
li.inline {
background: url("something.png");
display: inline;
padding-left: 3px;
padding-right: 7px;
border-right: 1px dotted #066;
}
li.last {
display: inline;
padding-left: 3px;
padding-right: 3px;
border-right: 0px;
}
}
</textarea>
<input type="button" onclick="tokenize()" value="Tokenize">
<p>(You may want to keep the CSS kinda small, this could take a while.)</p>
<div id="output">
</div>
<script type="text/javascript">
function tokenize(){
stream = new parserlib.css.TokenStream(document.getElementById("input").value);
document.getElementById("output").innerHTML = "";
setTimeout(function(){
var tt = stream.get();
var output = document.getElementById("output");
output.innerHTML += tt + " - " + parserlib.css.Tokens.name(tt) + " - (" + stream.token().value + "|line=" + stream.token().startLine + ",startCol=" + stream.token().startCol + ",endCol=" + stream.token().endCol + ")<br>";
if (tt != 0){
setTimeout(arguments.callee, 15);
}
}, 15);
}
</script>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.