[whatwg] CSSElementMap - updates needed for out-of-document elements
Tab Atkins Jr.
jackalmage at gmail.com
Thu Apr 28 17:15:49 PDT 2011
On Thu, Apr 28, 2011 at 3:02 PM, Ian Hickson <ian at hixie.ch> wrote:
> On Thu, 16 Dec 2010, Tab Atkins Jr. wrote:
>> 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.
> Done, though I think it would make more sense for this to be in the CSS
> spec, because otherwise every time we support new elements in CSS we have
> to modify the HTML spec as well.
My reasoning is just that the definition of what elements are valid to
use while outside the document varies based on the document language.
>> 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.)
> This seems like something CSS should define. HTML shouldn't need to define
> CSS terms like margin box. This can be defined in CSS generically without
> referencing HTML by just saying that an element not in a document has a
> margin box equal to its intrinsic dimensions, or whatnot.
Sounds reasonable. I'll go ahead and make the change on my side.
More information about the whatwg