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

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

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

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

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

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