1 Jun 2011 01:17
Microdata feedback
On Tue, 15 Mar 2011, Hay (Husky) wrote:
>
> Consider, for example, a list that contains custom data that needs to be
> displayed using Javascript. In most cases, the data-* attributes are a
> nice way to embed non-visual data to be read out later, but that doesn't
> work for hierarchical structures.
You can use nested HTML elements with data-* attributes. For example, the
JSON value {a:{b:'x',y:'z'}} could be represented as:
<div data-a>
<div data-b='x'></div>
<div data-c='y'></div>
</div>
> 1) Microdata. This could work, but only if the data should be displayed
> as well. If the data should be processed (and for example, be shown in
> another part of the page) this doesn't work really well. You could the
> hide the parent element with CSS, but that's pretty clunky.
You can use microdata with <link> and <meta> if you don't want to actually
show the information.
Hiding information in a page (whether it's in microdata, data-*, <script>
data blocks, or anything else) if generally frowned upon as the data tends
to end up less accurate than if it's visible, but that's something you
have to take under advisement.
> 2) data-* attributes with JSON data. Would work, but pretty ugly and not
(Continue reading)
RSS Feed