Re: <details>

On 14 Sep 2009, at 12:38, Anne van Kesteren wrote:

> One thing I'm afraid of is that if people start using <details>  
> before implementations are ready is that implementations can no  
> longer provide the functionality of <details> natively. From that  
> perspective I'm sort of happy authors cannot use it yet.

I take it you mean that if people start implementing the show/hide  
functionality of <details> in Javascript, this would interfere with  
native show/hide functionality?

This would be a reason to add <script implements> to HTML5. The HTML5  
documentation would define a URI that represents the functionality of  
the <details> element, say:

Then authors who wished to implement show/hide in Javascript so that  
they can use it straight away would just put:

	<script implements="">
	  // script to implement <details> goes here.

When new browser versions are released which have native  
functionality for <details>, they'd see the URI in the implements  
attribute, know that they already implement support for that feature,  
and thus ignore that entire <script> element.

The implements attribute appears in the most recent XHTML 2 and XML  
Events 2 drafts. It's a really nice hook for future-proofing  
websites, and pretty easy for user agents to implement; I think HTML5  
is all the poorer for not having adopted it yet.

Certainly there are ways it could be improved. For example, it would  
be nice if the implements attribute could be allowed to take relative  
URIs which are always evaluated relative to " 
xhtml/". That would allow for the previous example to be written as:

	<script implements="element#details">
	  // script to implement <details> goes here.

Other use cases would include websites providing Javascript that  
rewrites <audio> and <video> to, for example, Flash-based players in  
browsers with no native support for those elements - the implements  
attribute would provide a way of avoiding sniffing to guess which  
user-agents need the rewriting. Also, scripts that implement <canvas>  
in Internet Explorer, etc, etc.

Toby A Inkster

Received on Monday, 14 September 2009 13:13:43 UTC