[whatwg] CSSElementMap - updates needed for out-of-document elements

Tab Atkins Jr. jackalmage at gmail.com
Thu Dec 16 16:06:28 PST 2010

The CSSElementMap object defined in
allows an author to map an element to an identifier that CSS can then
use to refer to the element.  However, it allows elements that are
outside the DOM tree to be mapped, which creates a problem for CSS -
CSS has no notion of elements outside the element-tree.

We want to preserve this ability, so authors can, for example,
generate <canvas> in script, map it to an identifier, and then refer
to it with the element() function to provide an animated background
for an element.

While you can put any element in the map, only a subset of them make
sense to expose to CSS while out of the DOM.  Particularly, we want to
only expose the <img>, <video>, and <canvas> elements, as they have an
intrinsic notion of "size" that doesn't rely on layout information.

So, amendments:

1. While any element can be in the CSSElementMap, only elements are
either (a) in the DOM or (b) <img>, <video>, or <canvas> outside the
DOM are exposed as CSS Element Reference Identifiers.

2. <img>, <video>, and <canvas>, while outside the DOM, expose the
intrinsic width of their content as the size of their margin box.
(The margin box of the element is used in the description for
element() to figure out how large the generated image should be.)


More information about the whatwg mailing list