I recently watched Dav Glass' talk on YUI and node, and the server-side rendering of widgets got me particularly interested.
I want to do something similar, while still being able to use javascript for the widgets on the client side. The problem I am facing is how to run code associated with the widget (adding click events. etc) once the page is loaded.
One way of doing it could be to write an init function for each widget, then turn it into a string and put it in a script-tag along with the rendered html, but I don't think that's a very pretty solution.
Can anyone think of a better solution?