<html>
	<head>
			<title>Demo using dojox.dtl._DomTemplated</title>
			<script type="text/javascript" src="../../../dojo/dojo.js"
				djConfig="isDebug: true, parseOnLoad: true"></script>
			<script type="text/javascript" src="../../../dijit/dijit.js"></script>
			<style type="text/css">
				@import "../../../dijit/themes/tundra/tundra.css";
				#pane {
				    border: 1px solid darkblue;
				}
			</style>
	    <script type="text/javascript">
					dojo.require("dojox.dtl._DomTemplated");
					dojo.require("dijit.form.Button");
                    dojo.require("dijit.layout.ContentPane");

					dojo.declare("Fruit", [dijit._Widget, dojox.dtl._DomTemplated], {
						widgetsInTemplate: true,
						items: ["apple", "banana", "orange"],
						keyUp: function(e){
							if((e.type == "click" || e.keyCode == dojo.keys.ENTER) && this.input.value){
								console.debug(this.button);
								var i = dojo.indexOf(this.items, this.input.value);
								if(i != -1){
									this.items.splice(i, 1);
								}else{
									this.items.push(this.input.value);
								}
								this.input.value = "";
								this.render();
							}
						},
						// Note, the load tag here is superfluous, since _DomTemplate has a dojo.require for it.
						templateString: '<!--{% load dojox.dtl.contrib.dijit %}--><div><input dojoAttachEvent="onkeyup: keyUp" dojoAttachPoint="input"> <button dojoType="dijit.form.Button" dojoAttachPoint="button" dojoAttachEvent="onClick: keyUp">Add/Remove Item</button><div id="pane" dojoType="dijit.layout.ContentPane parsed"><ul><!--{% for item in items %}--><li><button dojoType="dijit.form.Button parsed" title="Fruit: {{ item }}" otherAttr2="x_{{item}}"><!--{{ item }}--><script type="dojo/connect" event="onClick" args="e">console.debug("You clicked", this.containerNode.innerHTML);</' + 'script></button></li><!--{% endfor %}--></ul></div></div>'
					});

					dojo.require("dojo.parser");
	    </script>
	</head>
	<body class="tundra">
		<div dojoType="Fruit" id="dtl"></div>
	</body>
</html>