html2canvas v0.4.0

January 30, 2013

Read time 2 min

This has taken far longer than I had hoped for it to do. Partly because of work on some other projects and partly due to lack of time. As far as the update is concerned though, it is the biggest one so far for html2canvas.

Perhaps the biggest improvement that comes with 0.4.0 are the automated rendering tests that allow lot easier updating of the code while still having assurance that the changes do not affect other parts of the rendering process. As I discussed in the previous blog post, the tests are ran through a grunt task and they use webdriver to launch real instances of Chrome, Firefox and IE to capture what the page should look like, and do a pixel comparison with the output generated by html2canvas. Current rendering results can be found here.

In addition, most of the code in the library has been refactored and in the process support for IE<9 was dropped as well. This means that even with the use of Flashcanvas or similar canvas emulation, html2canvas won’t work for IE8 or older.

As for new features, background rendering was improved, and support for background-clipping, sizing, and multiple backgrounds was added. The method used for border rendering was recoded, and along with it support for border-radius and box-sizing was added. In addition, support for pseudo elements (:before and :after) was added. For a full list of changes, check out the commit history.

As for the build process, html2canvas now uses grunt for linting, testing (qunit and webdriver) and building the files. The readme has been updated with instructions on how to build the library using grunt.

Finally, the documentation for the library got some long needed updates, and although there is still more that could be done there, it should at least be up to date now.

Sign up for our newsletter

Get the latest from us in tech, business, design – and why not life.