My application does bulk rewriting of the client-side DOM at boot time. He scans the page for special markup (think Markdown) or other templates, sometimes replacing them with fairly complex DOM structures (using DOM calls like createElement ) to style text and create charts and graphics.
I adopted this architecture to avoid any assembly steps or preprocessing. It works great in a desktop browser, but is noticeable on mobile devices (a few seconds, even after tireless optimization). So I would like to rebuild the system to pre-scan the page and pre-build the DOM. I have a little mental block that figures out how to do this. Obviously, I would prefer not to rewrite all Javascript in some other server language. In addition, I would like to keep the ability to make the building at boot time, as it is now, while the basic rewrite logic uses the same code.
The most likely option is to create this as a node application, although I'm a newbie to node. using jsdom both for parsing input and modifying the DOM. Or, since I'm a fan of XSLT and intrigued by Saxon-CE, although that would mean rewriting everything, I also considered using the scan / rewrite logic in XSLT to call either from node (for the pre-construction case - do people use Saxon from node? ) or a browser (for the case of building load times).
Can someone comment on this approach or throw away alternative ideas?
user663031 Oct 02 '12 at 3:15 2012-10-02 03:15
source share