caleb531 / jcanvas

A jQuery plugin that makes the HTML5 canvas easy to work with.
https://projects.calebevans.me/jcanvas/
MIT License
626 stars 192 forks source link

Internet Explorer IndexSizeError on drawImage #75

Closed mrdazey closed 11 years ago

mrdazey commented 11 years ago

The drawImage is not working in internet explorer, it gives an indexsizeerror. I have seen this in IE9 and IE10.

image

dksmiffs commented 11 years ago

Mark,

drawImage() is working for me on IE10.0.9200.16521 on Win7 Pro SP1 64-bit. Try this jsfiddle: http://jsfiddle.net/dksmiffs/YdPpy/

I think the problem with that Sandbox example you ran is that it can't find the "fish" image. I get the same IndexSizeError as you do on that one. Caleb, thoughts?

~ Dave

caleb531 commented 11 years ago

Strange, because the demo in the sandbox works just fine for me (and I have confirmed that img#fish is on the page).

After a little digging, I found that the spec says this:

If one of the sw or sh arguments is zero, the implementation must raise an INDEX_SIZE_ERR exception.

Therefore, I think this may be the issue at hand, although I obviously cannot say so with certainly. Either way, I've been thinking that the drawImage() method should be rewritten anyway, so we may also have an opportunity here, as we fix this issue, to fix many others.

-Caleb

dksmiffs commented 11 years ago

Caleb - I tested using FF & Chromium on my Linux box, and none of the "Image" Sandbox examples show any image at all except the one under "Referencing an Image Element".

caleb531 commented 11 years ago

After some testing in the Internet Explorer 10 VM, I have concluded that this issue is not a bug with jCanvas. Rather, it's a bug in the jCanvas sandbox.

In the given example, because the code is referencing an image element on the page, I have added that image to the HTML, and then I hid the image using CSS (display: none;). However, Internet Explorer will not load images that are hidden in this way. Therefore, I have fixed the sandbox code so the images will actually load in IE.

-Caleb