[uf-new] Metadata/machine-readable data patterns

Nelson Menezes flying.mushroom at gmail.com
Fri Mar 14 00:01:12 PST 2008


Hi all.

I was reading through
http://www.webstandards.org/2007/04/27/haccessibility when a possible
solution to that problem occurred to me. I've tried looking through
the list and wiki but haven't found a similar suggestion; however if
it's a been brought up before... apologies in advance.

To cut to the chase: why not use <input type="hidden" /> fields to
store metadata that must be machine-read within microformats? It would
avoid stretching the semantics of existing tags and (I believe) avoid
issues with screen readers. Besides, it's what the tag is for...

Here are a few more thoughts:

- <input> elements don't require being within a <form>. They do
require being within a block-level element in XHTML for validation.
The spec (http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.2.1)
mentions that "...elements used to create controls generally appear
inside a FORM element, but may also appear outside of a FORM element
declaration when they are used to build user interfaces."

- If they are within a <form>, they can be submitted (which might be a
desired effect) or not (by adding the disabled="disabled" attribute).

- To my knowledge, no user agent renders <input type="hidden" />
fields. Easily accessible via JS or any other parsers though.

- For identification of an element we could use the "name" attribute
(which can be repeated in the same page), or a class. Or it can be
inferred from its parent node.

Here's a half-baked, not-well-thought-through, example of how this
could be used to solve the hCard (or any other datetime) issue:

<div class="vevent">
 <a class="url" href="http://www.web2con.com/">http://www.web2con.com/</a>
  <span class="summary">Web 2.0 Conference</span>:
  <span class="dtstart"><input type="hidden" value="2007-10-05"
/>October 5</span>-
  <span class="dtend"><input type="hidden" value="2007-10-19" />19</span>,
 at the <span class="location">Argent Hotel, San Francisco, CA</span>
 </div>

Another possibility is to discard the <span>s altogether:

<div class="vevent">
  <a class="url" href="http://www.web2con.com/">http://www.web2con.com/</a>
  <span class="summary">Web 2.0 Conference</span>:
  <input type="hidden" name="dtstart" value="2007-10-05" />
  <input type="hidden" name="dtend" value="2007-10-19" />
  October 5-19, at the
  <span class="location">Argent Hotel, San Francisco, CA</span>
</div>

Good? Bad? Evil?

-- 
Nelson Menezes
flying.mushroom at gmail.com


More information about the microformats-new mailing list