3 ms·
What if the following line is executed after the hidden canvas's context has been modified? canvasElement.setAttribute('style', 'display:inline !important');
by halter73 15y ago
What if the following line is executed after the hidden canvas's context has been modified?
canvasElement.setAttribute('style', 'display:inline !important');
According to you, non-stupid browsers should have ignored the previous updates to the canvas to save CPU time. Maybe the browser could keep a record of all of the calls made to the canvas API while the canvas is hidden and then execute them when the canvas element becomes unhidden, but that seems clever to me. I certainly wouldn't call implementors of the canvas API that don't do this stupid.
In fact, there are probably good reasons not to do this. For example, if a web app makes frequent updates to a small hidden canvas, keeping a record of all the calls instead of simply executing them could end up using way too much memory.
If a browser simply ignores updates to the hidden canvas, it would be breaking standards.