Noticed two weird quirks yesterday, one in Chrome and one in Safari on iOS.
Usually to reset the content of the canvas tag one writes:
canvas.width = canvas width;
But that doesn’t really work in Chrome: the canvas stays the same and is not cleared.
It sort of works, though, in that afterwards, if one tries to paint something on the same canvas, the new information “clears” a zone around itself.
This reminded me of the strange Chrome behavior where if you have many tabs opened, and leave them opened for a long time, when you activate them again they “repaint” the page on the screen, quite slowly (AFAIK, no other tabbed browser does this).
I suspect that Chrome has a universal “lazy” approach (in the noble sense of the term found in “lazy evaluation”): don’t do anything until you absolutely have to. There is no point in maintaining the appearance of an invisible tab in memory (of a tab that hasn’t been visible for a while); there is no point in repainting a canvas until it’s used, esp. when set to new dimensions that are the same as the old ones.
Except, there is, since resetting canvas width is the accepted method of clearing it.
The workaround:
canvas.width = canvas.width + 1;
Then Chrome feels compelled to actually repaint the canvas.
Of course if you do this often, you’ll end up needlessly enlarging the canvas; what you want to do is storing the original size and playing with it: +1 or -1 every other time.
Having the console on in Safari on iOS breaks the offline capability of the app. But not always! and that’s what’s really weird: only apps launched from an icon in the dock, not apps launched from within Safari.
Here’s how to reproduce the problem:
The workaround: I don’t know of any; just make sure the console is disabled when trying to launch an app from an icon while offline.