Nearly three weeks ago my wife went on a trip with her sister’s family to visit her grandfather, who was celebrating his ninetieth birthday in Indiana. She was gone for four days, including an entire weekend. Now some guys might take an opportunity like that, call up whatever single friends they have left, and have some fun out on the town. I, on the other hand, realized that it had been a really, really long time since I’d last been able to indulge in an all-night hackathon 
I’ve got a couple of side projects going, but I finally settled on trying to get HtmlUnit to run through the jQuery unit tests. As web applications have gotten more and more complex, they’ve begun to rely on really complex libraries like jQuery, Dojo, Prototype and YUI to abstract away lower-level details like browser incompatibility and tedious APIs like getElementsByTagNameButOnlyOnMonday()… or something like that. I forget. The point is that HtmlUnit has not kept up with this trend (though we’re fairly compatible with Prototype).
Knowing that HtmlUnit has fairly advanced JavaScript support, I figured that full jQuery support couldn’t be more than two days work away. Well, three weeks later, I’m proud to announce that HtmlUnit 1.12 will fully support jQuery, and we can prove it because we run jQuery’s own unit tests as part of HtmlUnit’s unit tests. That’s a lot of units!
So now for the details. The following HtmlUnit bugs had to be fixed in order to reach this point:
Bug in string.replace() implementation when using string parameters. Bug in string.replace() implementation when using function parameters. Bug in the scope of eval() invocations in event handlers. Bug in document.getElementsByTagName(’*'), which was always returning an empty collection. Bug in default option selection in select elements without an explicit selection. Add missing IE-only element.style.filter attribute. Bug in element.innerHTML and element.outerHTML: uppercase tag names when emulating IE. Bug in element.innerHTML and element.outerHTML: don’t quote attributes that don’t contain whitespace when emulating IE. Bug in element.innerHTML and element.outerHTML: always use separate open and close tags (even if the tag is empty). Bug in element.innerHTML, element.innerText and element.outerHTML: escape XML characters inside text nodes. Allow background tasks initiated with setTimeout() to finish if clearTimeout() is called after they have started execution. The method element.style.getPropertyValue(’foo’) was expecting camel cased property names, rather than delimiter-separated names.
The first three bugs never even made it into a production release, because they were introduced in changes made since the last release (1.11). Only one of the fixes involved adding support for an entirely new feature — the rest were all refinements of existing implementations.
I think this is fairly indicative of how far along HtmlUnit’s DOM and JavaScript support has come, and I expect similar efforts with other JavaScript libraries to become less and less onerous as these refinements get to be smaller and fewer.
Indeed, support for the Prototype library is pretty far along (we also run its unit tests as part of HtmlUnit’s unit tests) and is blocked in many places by small incompatibilities between the Rhino JavaScript engine and the browser JavaScript engines — not by HtmlUnit bugs.
So enjoy the upcoming HtmlUnit release, and let us know if you run into any problems. And if you have the time and inclination, send a couple of patches our way 