html - getContext('2d') returns null in Safari 10 -


i cannot reproduce problem on our macbook's have logs users. problem when try use of rendering methods on canvasrenderingcontext2d crashes because it's null.

so have canvas element, has getcontext method return null. short list of checked potentials:

  1. the canvas element created, existing, has positive size , has getcontext method
  2. getcontext call executed after page loading (onload listener)
  3. there no other calls of getcontext other parameters ('webgl' example)
  4. in getcontext('2d') '2d' string in lower case
  5. this problem reproducing on safari 10
  6. in cases error occurs not after page load after user actions. mean canvas destroyed , re-created times, , worked.

i'm not sure if relevant situation described here, had similar situation able solve. perhaps helps down line. gist of problem browsers deal html5 canvases quite differently. in particular, amount of memory willing allocate canvases en total , individual canvases (constraints on height, width, , area) seem differ. never bothered grok details, here's stack question addressing of constraints

for me, generating many independent canvases , managing 2d context separately. problem wasn't being careful garbage collection, , took me long time notice because testing part in chrome, in worked fine.
meanwhile behavior in firefox project became totally unresponsive without throwing meaningingful errors, , in safari contexts fine until ran out of total memory allocate canvases, , getcontext('2d') return null.

my first solution reduce resolution of canvases, better solution dispose of ones wasn't using , generate them on fly.


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -