W3C home > Mailing lists > Public > public-html@w3.org > May 2007

<code type="...">

From: Josh Sled <jsled@asynchronous.org>
Date: Fri, 25 May 2007 19:29:24 -0400
To: public-html@w3.org
Message-ID: <87ejl4pjmz.fsf@phoenix.asynchronous.org>

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

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)]

]]] differently from [[[

    <pre><code type="application/json">
    {'foo': ['bar', 'baz','quux'],
     'bar': 42,

]]] in a blog posting using such code as examples.

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

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

http://asynchronous.org/ - a=jsled; b=asynchronous.org; echo ${a}@${b}

Received on Friday, 25 May 2007 23:29:28 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 29 October 2015 10:15:21 UTC