As promised I've prepared some demos of the new JSB and chrome packages.
JSB = JavaScript behaviors. This library is mostly complete. There is a
very basic demo here:
http://base2.googlecode.com/svn/trunk/test/JSB/simple-test.html
JSB does not use DOMContentLoaded to attach behaviors. Instead it is
continually querying the DOM to look for elements. It can do this
because base2's Selectors API is *re-entrant*. That means it can stop
querying the DOM to yield processing. It can then start querying again
from where it left off. JSB will also stop processing as soon as you
start interacting with the page. This means that behaviors are instantly
usable. Finally, it uses event delegation so that there is little
overhead in adding event handlers.
JSB is about 95% complete. Currently it does not support the use of CSS
pseudo-classes to define behaviors.
The "chrome" package provides additional GUI controls. It is built on
top of JSB and is meant to provide similar features to Web Forms 2.0.
Here is a list of controls that chrome will eventually provide:
* Spinner
* Slider
* Progress Bar
* Date Picker
* Time Picker
* Combobox
I might add some more. Requests are welcome.
Chrome is only about 40% complete. The combobox control is barely
functional and the date/time pickers are not written at all. Mousewheel
support is a bit buggy and generally it is quite buggy. But this is a
sneak preview so who cares? :-)
Chrome is meant to look exactly like the browser chrome. That means a
Safari slider looks different to a IE7 slider. Chrome can detect your XP
theme, try it and see!
Finally, because chrome UI is built using background-image sprites,
there is no need to style the widgets yourself. Everything is purely
declarative.
Anyway, enough with the chat. Here is a very simple demo that attaches
40 behaviors:
http://base2.googlecode.com/svn/trunk/test/JSB/test40.html
The following demo adds 4000 behaviors. Please note that this pretty
slow in FF2. This is not the fault of JSB/chrome. Even with no JS this
page loads slowly in FF2. FF3 is a big improvement.
http://base2.googlecode.com/svn/trunk/test/JSB/test4000.html
Finally, a page that adds 40,000 behaviors. I'm not sure you can do this
with any other library without crashing the browser:
http://base2.googlecode.com/svn/trunk/test/JSB/test40000.html
In the last demo you can see pretty clearly that behaviors are attached
whilst the page is loading. The behaviors are immediately usable even
though we have not yet hit DOMContentLoaded.
I'm very interested in feedback. So let me know what you think. If there
are any widgets that you would like added to the "to do" list then now
is the time to say so! :-)
-dean
A little. Chrome will provide a similar set of widgets to those
specified in the Web Forms 2.0 spec. It will not provide a repetition
model or a validation model. I do intend to write those but they will
not be part of Chrome.
-dean