Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
64 lines (53 sloc) 2.74 KB
<html>
<head>
<title></title>
</head>
<body>
<h1>Test</h1>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.js"></script>
<script type="text/javascript" src="jsml.js"></script>
<div id="test-div"></div>
<div class="multiple-div"></div>
<div class="multiple-div"></div>
<div class="multiple-div"></div>
<div id="old-jquery"></div>
<div id="my-element"></div>
<div id="array-test"></div>
<div id="outside-els-test"></div>
<ul id="multiple-args-test"></ul>
<div id="jquery-nested-array"></div>
<div id="dom-nested-array"></div>
<div id="nested-array-mixed"></div>
<script type="text/javascript">
var table = ["table", { border: "true" },
["tbody",
["tr", ["td", "Cell 0,0"], ["td", "Cell 1,0"], ["td", "Cell 2,0"]],
["tr", ["td", "Cell 0,1"], ["td", "Cell 1,1"], ["td", "Cell 2,1"]],
["tr", ["td", "Cell 0,2"], ["td", "Cell 1,2"], ["td", "Cell 2,2"]]]];
$("#test-div").jsml(table);
$(".multiple-div").jsml(table);
$("#old-jquery").html("<h1>old</h1><ul><li>list item 1</li><li>list item 2</li></ul>");
var a_random_variable = "</li> uh oh, bad stuff in here <script>";
$("#my-element").jsml(["ul",
["li", { style: { backgroundColor: "red" } }, "First item"],
["li",
["img", { src: "http://www.google.com/favicon.ico", alt: "some alt-text"},
{ title: "A Title" }], a_random_variable]]);
var a = [["li", "Item 1"],
["li", "Item 2"],
["li", "Item 3"]];
$("#array-test").jsml(["div", ["h1", "Nested array"], ["ul", a]]);
var li1 = document.createElement("li");
li1.appendChild(document.createTextNode("document.create()"));
$("#outside-els-test").jsml(["div",
["h1", "Outside elements"],
["ul", li1, $("<li>jQuery element 1</li><li>jQuery element 2</li>")]]);
$("#multiple-args-test").jsml(["li", "arg 1"],
["li", "arg 2"],
["li", "arg 3"]);
$("#jquery-nested-array").jsml(["h1", "jQuery Nested"], ["ul", [$("<li>1</li>"), $("<li>2</li>"), $("<li>3</li>")]])
$("#dom-nested-array").jsml(["h1", "DOM Nested"], ["ul", [$.fn.jsml.dom(["li", "1"]), $.fn.jsml.dom(["li", "2"]), $.fn.jsml.dom(["li", "3"])]])
$("#nested-array-mixed").jsml(["h1", "Nested Mixed"], ["ul", [$("<li>1</li>"), $.fn.jsml.dom(["li", "2"]), $("<li>3</li>"), $.fn.jsml.dom(["li", "4"])]])
</script>
</body>
</html>