[whatwg] CSS canvas() function

Tab Atkins Jr. jackalmage at gmail.com
Wed Dec 1 14:16:35 PST 2010


On Tue, Nov 23, 2010 at 5:35 PM, Robert O'Callahan <robert at ocallahan.org> wrote:
> On Wed, Nov 24, 2010 at 2:23 PM, Tab Atkins Jr. <jackalmage at gmail.com>
> wrote:
>>
>> For example, I've recently been playing with fractals in canvas, and
>> temporarily set my blog to have a screen-filling canvas z-index'd
>> below the content, filled with an interactive fractal (the mandelbrot
>> set, overlaid with the julia set for the point your mouse was over).
>> It would be better/cleaner/easier/more semantic to just draw directly
>> into the <body> background, which is what I was faking with abspos and
>> z-index.
>
> OK.
>
>> How about just using canvas() to refer to setImageElement() things?
>>
>> This retains the flexibility that setImageElement has over
>> getCSSCanvasContext, while removing the weirdness of transparently
>> overriding #ids and keeping element() open to accept arbitrary
>> selectors?
>
> Special syntax to refer to setImageElement elements would be OK, but I
> wouldn't choose "canvas()", since the element can also be a <video> or
> <img>.
>
> How about element(<ident>) to refer to setImageElements, element(#id) for
> DOM IDs, and element(first(<selector>)) for selectors? (I don't necessarily
> endorse the idea of extending to selectors, FWIW, but I appreciate the
> desire to keep the possibility open.)

I've gone with using element() for selectors (limited to only ID
selectors, but other valid selectors are accepted, they just don't
currently do anything).  Then element-ref() takes an ident, which the
js function maps to an element.

Sound cool?

~TJ


More information about the whatwg mailing list