Javascript + DOM in your ruby, the simple way
11–18 of 18 posts
Re: Javascript + DOM in your ruby, the simple way
#12(FWIW, a coworker and I did this a few years ago with Rhino and a custom-hacked mock DOM. Doing it with a real DOM, like what an XML parser gives you for your actual page, is much better! Hopefully that's what this library allows.)
Re: Javascript + DOM in your ruby, the simple way
#13Re: Javascript + DOM in your ruby, the simple way
#14Re: Javascript + DOM in your ruby, the simple way
#15So, which browser's quirks does this emulate? And what version of HTML does it support? (seriously. and what user agent does it report? developing cross-browser code is often important) I can see how this could be extremely useful, but it does strike me as yet another source for unique bugs in your JS-manipulating-DOM code, and it's potentially even harder to find out why they're happening.
If you use a client-side js framework like JQuery or Prototype, the cross browser compatibility isn't an issue since it's taken care of for you. The user agent it reports as is irrelevant - it's not a full http client. You can use other ruby tools to fetch a page if you want, and then feed harmony the document. As others pointed out, testing is probably the main use case, but it offers other obvious possibilities; fo…
As to the libraries to make things cross-browser compatible, knowing which browser it tries to emulate would be essential to knowing which lines of code would be executed through this tool. If you can't test the IE-specific code, what's the use if you're developing for IE?
Re: Javascript + DOM in your ruby, the simple way
#16Re: Javascript + DOM in your ruby, the simple way
#17Re: Javascript + DOM in your ruby, the simple way
#18Semi-related: How do I write Ruby and poop out Javascript?