W3C home > Mailing lists > Public > public-canvas-api@w3.org > January to March 2012

display: contents as a possible solution for subtree visibility

From: Charles Pritchard <chuck@jumis.com>
Date: Thu, 02 Feb 2012 10:50:43 -0800
Message-ID: <4F2ADB03.10609@jumis.com>
To: Canvas <public-canvas-api@w3.org>
Currently, to debug fallback content, authors have to alter the canvas 
tag name and/or remove fallback content from the canvas in order to view 
it. They can also use a browser that does not support Canvas.

Over at www-style, we may have hit on a CSS attribute which will benefit 
Canvas authors. At present, it's being floated as display: contents. The 
name is still unstable.

Code example:
<canvas style="display: contents"><div>This is now visible fallback 
<audio style="display: contents">I am visible fallback content too!</audio>

Currently, for debugging, I use IE9, and simply switch it over to IE8 
compatibility mode, when I want to debug my fallback content.

I encourage implementers to consider how this feature may be added to 
their code base.

Tab Atkins responded with some ideas on how to implement it in WebKit:
"You would ... apply a fresh shadow subtree that just grabbed the 
light-DOM children."

This would have some impact on the manner in which setElementPath is 
implemented. I'd recommend the paths be cached, as display: contents 
does not remove any elements from the DOM. In that instance, if display: 
were set back to inherit, inline or block, the bound paths would once 
again be exposed. This process can happen as the DOM children are 
converted between "light" and "heavy" DOM nodes.

Received on Thursday, 2 February 2012 18:51:07 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:31:54 UTC