Accidentally, I noticed I could use the id of an HTML element in JavaScript code. So instead of this:
var myCanvas = document.getElementById('myCanvas'); myCanvas.width = '600'; myCanvas.height = '400'; I could simply not even have the first line, because the variable myCanvas apparently already exists!
myCanvas.width = '600'; myCanvas.height = '400'; This is nice, but can I rely on it? Is this normal behavior that I can expect in all modern browsers? I don't care about any browsers before IE9.