Re: <code type="...">

Josh Sled wrote:
> <code> should have a type attribute, which indicates the media type of the
> inlined content(-fragment).

Some might say that HTML is already strangely specific for computing 
type applications, with its inclusion of <code>, <var>, <samp>, <kbd>. 
Further refining these elements seems weird, considering that other 
areas are still arguably lacking more adequate elements to better mark 
up content.

> As a use-case, a (hypothetical) javascript library -- say, during body onLoad
> -- could parse and syntax-hilight [[[
> 
>     <pre><code type="text/x-python-source">
>     def foo():
>         return [x**2 for x in range(10)]
>     </code></pre>
> 
> ]]] differently from [[[
> 
>     <pre><code type="application/json">
>     {'foo': ['bar', 'baz','quux'],
>      'bar': 42,
>     }
>     </code></pre>
> 
> ]]] in a blog posting using such code as examples.

Your use example seems to suggest that you'd want it mainly for styling 
reasons...in which case I'd argue that this could be more appropriately 
solved by using class attributes (but not by reserving those in the spec).

> Extending, user-agents might dispatch to external handlers or formatters
> based on @type.

Handlers? Are you proposing that <code> should actually be *executed*?

> Also, I note the analog with <object type=...>.

But <object> actually *does* something, as opposed to <code> whose 
purpose is to mark up a code fragment for display/presentation, not 
execution.

P
-- 
Patrick H. Lauke
______________________________________________________________
re·dux (adj.): brought back; returned. used postpositively
[latin : re-, re- + dux, leader; see duke.]
www.splintered.co.uk | www.photographia.co.uk
http://redux.deviantart.com
______________________________________________________________
Co-lead, Web Standards Project (WaSP) Accessibility Task Force
http://webstandards.org/
______________________________________________________________
Take it to the streets ... join the WaSP Street Team
http://streetteam.webstandards.org/
______________________________________________________________

Received on Friday, 25 May 2007 23:43:36 UTC