[whatwg] [2D Canvas] Do canvases in documents without a browsing context need to be rendered?

Rik Cabanier cabanier at gmail.com
Wed Mar 5 21:18:01 PST 2014

On Wed, Mar 5, 2014 at 8:48 PM, Boris Zbarsky <bzbarsky at mit.edu> wrote:

> On 3/5/14 11:42 PM, Rik Cabanier wrote:
>> Since this is such a small edge case, it seems reasonable to disallow the
>> creation of a 2d context and throw an exception. Going through all the
>> APIs
>> and flagging them as suitable for a context-less environment is not really
>> worth the effort.
> What happens if I create a 2d context while in a document and then adopt
> the <canvas> into a document that has no browsing context?

As soon as the context is adopted, you get the same behavior [1] when you
draw text.
It seems that we need to go call-by-call after all. Maybe just text APIs
should be disallowed for context-less canvas? Quickly skimming the spec, I
can't find other instances where this would be a problem.

As an aside, won't the text APIs [2] on Path2D have the same issue? They
are not connected to a browser context so how will they work?

1: http://codepen.io/anon/pen/gcqet

More information about the whatwg mailing list