I've also got a document.write lib:
https://github.com/iamnoah/writeCapture that integrates with CJS:
https://github.com/iamnoah/writeCapture/wiki/ControlJS
I haven't tried it out, but it looks like you're trying to parse input
as it arrives and create DOM nodes immediately, right? Sounds very
cool, I hope you can make it work. My lib waits for completion for the
most part, but there is a class of script (that use DOM and
document.write for some reason) that is tough to work with. Your
approach looks promising. Have you looked at John Resig's HTML parser?
http://ejohn.org/blog/pure-javascript-html-parser/
That might be able to cut down your code size a bit.
Cheers,
Noah
-Steve