<!DOCTYPE html>
<html>
<head>
	<script src="/usr/share/javascript/jsquery/jquery.min.js" type="text/javascript"></script>
	<script src="/usr/share/javascript/jsrender/jsrender.min.js" type="text/javascript"></script>
	<link href="../resources/demos.css" rel="stylesheet" type="text/css" />

	<link href="../resources/movielist.css" rel="stylesheet" type="text/css" />
</head>
<body>
<a href="../demos.html">JsRender Demos</a><br />

<h3>Comparison tests</h3>

<pre>
{{if !(languages && languages.length)}}...{{/if}}

{{if languages==null}}...{{/if}}
</pre>

<!--================ Demo ================-->

<script id="movieTemplate" type="text/x-jsrender">
	<tr>
		<td>{{>title}}</td>
		<td>
			{{if !(languages && languages.length) tmpl="#messageTmpl"/}}
		</td>
		<td>
			{{if languages==null tmpl="#messageTmpl"/}}
		</td>
	</tr>
</script>

<script id="messageTmpl" type="text/x-jsrender">
	<b>Warning:</b> <em>No alternate languages</em>
</script>

<table>
	<thead><tr><th>Title</th><th>{{if !(languages && languages.length)}}</th><th>{{if a==null}}</th></tr></thead>
	<tbody id="movieList"></tbody>
</table>

<script type="text/javascript">
	var movies = [
		{
			title: "Meet Joe Black",
			languages: null
		},
		{
			title: "The Mighty",
			languages: []
		},
		{
			title: "Eyes Wide Shut",
			languages: [
				{ name: "French" },
				{ name: "German" },
				{ name: "Spanish" }
			]
		}
	];

	$( "#movieList" ).html(
		$( "#movieTemplate" ).render( movies )
	);

</script>

</body>
</html>
