Moved common code from dom.js and canvas.js to elements.js
Canvas renderer: Intial suppport for images