If you are not familiar with .NET and the precious runat="server" or runat="client", have a look a at: http://www.aptana.com/jaxer
The idea is simple and very very practical. In some situations, you may want to run code on the server OR on the client. The problem with a lot of javascript frameworks is they do a LOT of work on the client side. What if we could make the server work a little harder?
Based on John Resig's work,
http://ejohn.org/blog/bringing-the-browser-to-the-server/
I convinced myself I could create a "template parser" for dijit widgets that would read the following tags:
<dijit:form:CheckBox id="cb" runat="server"/>
<dijit:form:CheckBox id="cb2" runat="client"/>
The first part was making sure that a dijit widget could be created on the server side.
Amazingly after some tweaks, this works:
C:\Utils>java -jar js.jar
Rhino 1.6 release 7 2007 08 19
js> load('env.js');
js> window.location = 'test.html';
test.html
js> var djConfig = {baseUrl: "Z:/GDECORE/js/OpenAjax/dojo/"};
js> load('Z:/GDECORE/js/OpenAjax/dojo/dojo.js');
js> dojo.require('dojo._base.html');
[object Object]
js> dojo.require('dijit.form.CheckBox');
[object Object]
js> var widget = new dijit.form.CheckBox({id: "cb", name: "cb"}, dojo.byId("test"));
js> print(dojo.body().innerHTML);
<div role='presentation' waiRole='presentation' class='dijitReset dijitInline dijitCheckBox' widgetId='cb'><input dojoAttachEvent='onmouseover:_onMous
e,onmouseout:_onMouse,onclick:_onClick' id='cb' class='dijitReset dijitCheckBoxInput' value='on' tabindex='0' type='checkbox' dojoAttachPoint='focusNo
de' name='cb'/></div>
The template parser has now been written and several more tests are needed before a first release!