The example shown on fillStyle for patterns is wrong:
This:
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
var img=document.getElementById("lamp");
var pat=ctx.createPattern(img,"repeat"); ctx.rect(0,0,150,100);
ctx.fillStyle=pat;
ctx.fill();
Should be this:
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
var img=document.getElementById("lamp");
var pat=ctx.createPattern(img,"repeat"); ctx.fillStyle=pat;
ctx.fillRect(0,0,150,100);
This is the only way the repeat keywords work as they should.
p.s. didn't know where else to give feedback on this.