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

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

From: Daniel E. Renfer <Duck@Kronkltd.net>
Date: Mon, 2 Jul 2007 14:11:31 -0400
Message-ID: <36bd6e0b0707021111y2529835fvd61e1429e997b5ba@mail.gmail.com>
To: "public-html@w3.org" <public-html@w3.org>
On 7/1/07, Dão Gottwald <dao@design-noir.de> wrote:
> Josh Sled schrieb:
> > liorean <liorean@gmail.com> writes:
> >> Further, do we have a reason for assuming that a class attribute
> >> doesn't deal with this adequately?
> > [...]
> >> However, I don't really see what a type attribute adds that a class
> >> attribute could not be used to provide instead.
> >
> > @class would work in practice, yes.
> >
> > In a simple experiment with firefox, it seems like one would need to use
> > the CSS selector code[class~="application/javascript"] rather than
> > code.application/javascript, but so what.
> code.application\/javascript should work.
> Dao

The question shouldn't be if what needs to be done can be done with a
combination of @class and CSS, but rather if it add meaningful
semantic information. Most of the elements in HTML could be replaced
with <div> elements and @class to set their style. The reason that is
done is because <table> carries richer semantics than <div

So, the question is, does code/@type add meaningful information
without contributing to element/attribute overload?

I would say yes.

I see <code> as being somewhat similar to <style>. The difference
being that <code> is displayed but not executed while <style> is
executed but not displayed. The @type attribute on <style> elements
carries the information of what language the contained code is in.
This is used by the browser to know what parser should be used, but
can be used by other things as well.

The reason that people don't shove the mediatypes of their code into
@class attributes is because there is no standard way telling people
to do it. (or even that they should) If we add a @type attribute to
<code>, we'll start to see more people use it.

If all my <code> blocks are marked up appropriately, I could easily do
searches for snippets of code in my posts in javascript. (//code[@type
= "text/javascript"])

Daniel E. Renfer
Received on Monday, 2 July 2007 18:11:34 UTC

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