title attribute and
abbreviatedclassnames(Was:[uf-discuss]Currency Quickpoll:
Preliminary results)
Brian Suda
brian.suda at gmail.com
Fri Oct 20 06:27:54 PDT 2006
On 10/20/06, Mike Schinkel <mikeschinkel at gmail.com> wrote:
> So I am just starting to grok how you have been using <abbr> vs.
> <span>/<div> but practically what I remember hearing and reading to date was
> that classes and titles can be equally applied to any HTML element, so that
> made me think they were all equal. But what I'm now learning is that,
> although they are all equal, <abbr> is more equal than others. Right?
--- there are elements in HTML which convay more semantic information.
For instance, when parsing, if your property is on an <a> element, you
look to the @href value to extract the data.
<a href="http://example.com" class="url">here1</a>
<span class="url">here2</span>
In that example, the <a> element convays the semantics of a link, so
we use the @href and get a value of http://example.com. The <span>
doesn't convay any specific semantics, so the node value is used and
we get a value of 'here2'. The same works for <abbr> we look to the
@title attribute for the value. Other elements such as <img> <area>
<dfn> and a few others convay specific semantics and the parsing rules
are slightly different. It also depends on the property. For instance
<img src="/images/brian-suda.png" class="fn photo" alt="Brian Suda" />
that has two properties "FN" and "PHOTO". Because this is an IMG
element certain semantics and available to us for data extraction.
The PHOTO value will be the data in @src
PHOTO:/images/brian-suda.png
Now the FN value according to the vCard RFC is a string and not a URI,
so the data for FN is taken from the @alt
FN:Brian Suda
Then from that we get implied N rules, etc....
So there are lots of tips and tricks to parsing all of this, much of
which can be found on the wiki under hcard-parsing
> ... Especially since I wasn't really aware of the semantics
> when I proposed the example. That said, is this any more acceptable (<span>
> instead of <abbr>?
>
> <span class="currency usd">$5.99</span>
> <span class="currency dkk">35.66 kr</span>
--- not really for several reasons. Now that you have switched to
span, you are still saying that the "currency" is equal to "$5.99"
which still isn't semantically correct. The currency is USD or $. The
value/ammount is 5.99. Ultimately we still have not exposed the TYPE
of currency USD,DKK into any human-readable format.
> But of course you made a good point about "minting an XMDP file" and not
> wanting to enumerate all the currencies, so that one is specifically bad.
> But is this?
>
> <span class="currency" title="USD">$5.99</span>
> <span class="currency" title="DKK">35.66 kr</span>
--- getting closer. The span element does not afford us any additional
semantics, so the @title is ignored in favour if the human-readable
node value, in this case $5.99, which again isn't semantically
"currency", and the USD would be completely ignored because no where
is it represented as a human-readable string, it is floating in the
@title by itself.
To do what (i think) you want, you need the ABBR
<span class="currency"><abbr title="USD">$</abbr>5.99</span>
now that has exposed the type of currency as a human-readable value $
and a machine consumable value "USD" from the @title because it is an
<abbr> element. The next step is to explicitly label that abbr so
parser know it is the TYPE.
<span class="currency"><abbr class="type" title="USD">$</abbr>5.99</span>
You need this explicitly because it is possible to have multiple
<abbr>s inside your <span class="currency">
> Or this?:
>
> <span class="currency" title="5.99 USD">$5.99</span>
> <span class="currency" title="35.66 DKK">35.66 kr</span>
--- same as above the @title is not even considered in this situation.
> I think I'm starting to get your objections; in the browser for the four
> prior examples you would see "USD", "DKK", "5.99 USD", "35.66 DKK" none of
> which might be the best for those numbers, right? (Though I'm not sure what
> title would be appropriate. Hmmm.)
--- correct, and the fact that it is a span element, for which, the
@title doesn't apply.
> >> I personally like this idea:
> >> <span class="money"><abbr class="currency" title="USD">$</abbr>
> >> <span class="amount">5.99</span></span>
>
> I'm still really bothered by the *amount* of markup for something that is,
> w/o markup, very tiny.
--- i'm not going to debate the additional mark-up, at the end of the
day, adding semantic meaning and metadata into a page is not free. You
can't have your cake and eat it too. I think that others have shown
that with gzip the additional markup that was added and zipped is
actually smaller than the original source file anyway. And (this is
completly unsubstanciated) i would guess MOST folks don't even
optimize their images, which would give you a MUCH greater bandwidth
savings than 1-2KB of semantic plain-text.
> P.P.S. Sure we can't just lobby the W3C to approve REL tags and maybe a few
> more for all (X)HTML elements? :-) :-) :-)
--- you don't need the W3C in this situation, Atom which is an IETF
standard has introduced several new rel values. So it would be
possible to introduce values through RFCs as well as W3C
Recommendations.
-brian
--
brian suda
http://suda.co.uk
More information about the microformats-discuss
mailing list