- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Thu, 16 Dec 2010 16:06:28 -0800
The CSSElementMap object defined in <http://www.whatwg.org/specs/web-apps/current-work/complete/dom.html#dom-document-csselementmap> 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.) ~TJ
Received on Thursday, 16 December 2010 16:06:28 UTC