- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Thu, 28 Apr 2011 18:20:08 -0700
- To: www-style list <www-style@w3.org>, "L. David Baron" <dbaron@dbaron.org>, Boris Zbarsky <bzbarsky@mit.edu>
The Image Values module specifies the element() function, which allows you to use the rendering of an element from the page directly as an image in CSS. This was inspired by, and closely follows, the experimental -moz-element() function in Gecko. One particular detail of -moz-element() that I copied over was that images, canvases, and videos can be referred to from element() without being part of the document - you can just do a "document.createElement('canvas')" and draw on it without ever appending it to the document, but still use it in -moz-element(). Hixie was recently tweaking the HTML side of this (you need a mechanism to refer to the detached elements, since Selectors can't target them), and was curious why I excluded other replaced elements like <iframe>. I don't have a very good answer to this question, so I wanted to see what reasoning there was in Gecko to not allow other detached replaced elements to be used. (The best I've got so far is that all the data necessary to display img/video/canvas is present automatically, as part of the elements' natures, so it's easy to present that data via element() even if the element's not in the DOM. However, an <iframe> needs to actually do layout on its contents to be displayed; this *can* be done without a surrounding document, but it's extra work.) Any hints? ~TJ
Received on Friday, 29 April 2011 01:20:55 UTC