W3C home > Mailing lists > Public > public-html@w3.org > September 2009

Re: <details>

From: Toby Inkster <tai@g5n.co.uk>
Date: Mon, 14 Sep 2009 14:12:51 +0100
Message-Id: <C966C546-5EE0-4496-ADC9-4C43BFEE9FDB@g5n.co.uk>
Cc: "Jeremy Keith" <jeremy@adactio.com>, "Ian Hickson" <ian@hixie.ch>, "HTML WG" <public-html@w3.org>
To: "Anne van Kesteren" <annevk@opera.com>
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:

	http://www.w3.org/1999/xhtml/element#details

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

	<script implements="http://www.w3.org/1999/xhtml/element#details">
	  // script to implement <details> goes here.
	</script>

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 "http://www.w3.org/1999/ 
xhtml/". That would allow for the previous example to be written as:

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

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
<mailto:mail@tobyinkster.co.uk>
<http://tobyinkster.co.uk>
Received on Monday, 14 September 2009 13:13:43 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:16:48 GMT