[uf-discuss] hCard, i18n and screen readers
mail at tobyinkster.co.uk
Sun Jan 16 10:40:48 PST 2011
On Tue, 11 Jan 2011 17:06:33 -0800
Jeff <codedread at gmail.com> wrote:
> Doesn't HTML5 microdata use the <meta> element for this purpose?
That doesn't really work outside XHTML.
The problem is that the HTML5 parsing algorithm hoists <meta> elements
into the document head. In other words:
<meta name="foo" content="bar">
var heads = document.getElementsByTagName('head');
var metas = heads.getElementsByTagName('meta');
window.alert(metas.name + metas.content);
Will alert "foobar". The browser assumes that you really meant to put
the <meta> element in the head. This behaviour is inherited from legacy
browsers who made this assumption because <meta> has never been allowed
in the <body>.
RDFa's content attribute is a nice solution for hiding a machine
readable value, and somewhat less of a hack:
<p about="#i" rel="foaf:based_near">
I live in <span property="geo:lat_long"
content="50.875627;0.017855">Lewes (50°52′N, 0°1′E)</span>
Toby A Inkster
<mailto:mail at tobyinkster.co.uk>
More information about the microformats-discuss