alternates-brainstorming

From Microformats Wiki
Revision as of 17:50, 22 April 2015 by Tantek (talk | contribs) (put warning out of date)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
⚠️ Warning: The brainstorming in this page is out of date, and predates modern standards such as Microformats in HTML5 and responsive images.

Introduction

This page is to talk about alternates, that is, places where a user may be given several different items to choose amongst that at some logical level are considered equivalent. The best stawman so far is #6.

Discussion Participants

Editor

Authors

Interested Folks

  • Joshua Kinberg
  • Ernest Prabhakar
  • Sean Gilligan

Brainstorms

Strawman 1

<fieldset>
 <a href="example.mp3" type="audio/mpeg">MP3 alternative</a>
 <a href="example.wav" type="audio/wav">WAV alternative</a>
 <a href="example.mov" type="video/quicktime">MOV alternative</a>
</fieldset> 

XHTML Sample

Discussion

  • is legal but warps XHTML definitions -- David Janes
  • I think that is fieldset abuse -1 KevinMarks

Strawman 2

   <select id="entryN">
     <option value="example.mp3">MP3 alternative</option>
     <option value="example.mov">WAV alternative</option>
     <option value="example.wav">MOV alternative</option>
   </select> 

XHTML Sample

Discussion

  • is legal but warps XHTML definitions -- David Janes
  • butt ugly, probably beyond redemption -- David Janes
  • the alternatives aren't clearly links -1 KevinMarks

Strawman 3

<div class="altgroup">
 <a class="alternate" href="example.mp3" type="audio/mpeg">MP3 alternative</a>
 <a class="alternate" href="example.wav" type="audio/wav">WAV alternative</a>
 <a class="alternate" href="example.mov" type="video/quicktime">MOV alternative</a>
</div> 

Discussion

  • Looks better, but we have an existing rel="alternate" in HTML

Strawman 4 (lists)

An example of a list that expresses no preference.

<ul class="altgroup">
 <li><a href="example.mp3" type="audio/mpeg">MP3 alternative</a></li>
 <li><a href="example.wav" type="audio/wav">WAV alternative</a></li>
 <li><a href="example.mov" type="video/quicktime">MOV alternative</a></li>
</ul> 

An example of a list that expresses a preference (i.e. first is best, last is worst)

<ol class="altgroup">
 <li><a href="example.mp3" type="audio/mpeg">MP3 alternative</a></li>
 <li><a href="example.wav" type="audio/wav">WAV alternative</a></li>
 <li><a href="example.mov" type="video/quicktime">MOV alternative</a></li>
</ol> 

Discussion

  • this rocks, though I'm a little indifferent to altgroup. The only downside is that 'loosely coupled' alternates may not be covered; on the other hand, this may not be so much of an issue. We will know more from the examples -- David Janes
  • I like this a lot, and the ul/ol distinction is good, but the rel="alternate" should be there too.

Strawman 5 (lists + explicit alternator)

This varies #4, explicitly stating what is being alternated. Let's say we're trying to express "location". If there was no alternates, we'd just say:

<a href="example.mp3" class="location">MP3</a>

Now, let's say that we have multiple choices. Here's what I think it should look like:

<ol class="location alternates">
  <li>
    <a href="example.mp3" class="location">MP3</a>
    <br />
    I ripped this one using <a href="...">iTunes</a>
  </li>
  <li>
    <a href="example.wma" class="location">WMA</a>
    <br />
    I ripped this one using <a href="...">Windows Media</a>
  </li>
</ol> 

Discussion

David Janes:

  • "alternates" indicates there's a bunch of choices to follow
  • "location" appears multiple times because ...
  • "location alternates" indicates we're _composing_ the alternates MF with "location"

Lucas Gonze:

  • I fiddled around with CSS and javascript to support this and found it was pretty easy to work with. That's a big plus.
  • A drawback is that it departs from existing idioms for microformats.
  • A plus is that the same method can be applied to other variants of the Alternates microformat. Let's say you have some MF that depends on a class "photo" to distinguish which one of multiple IMG elements is the alternate, you can declare the OL or UL with class="photo alternates".
  • Another plus is that the technique can extend out to more than one item per option, like if there must be both a photo and a location; that would be <ul class="photo location alternates" />
  • I have one real doubt. If we're inventing a new syntax to extend the Alternates MF even before the ink is dry, I'm not certain it is adding anything except a hint to help search engines understand the page. I have to think about that issue a bit more.

David Janes:

  • I love the fact that it can be applied to other MFs. For example, you could do something like this to express alternate vcards for the same person...
<ol class="vcard alternates">
  <li><div class="vcard">vcard 1</li>
  <li><div class="vcard">vcard 2</li>
</ol>
  • ... that said, it'd probably be best to run this past everyone else, as it does change the way parsing would happen. Perhaps it's only valid for inner elements?

Strawman 6 (lists + explicit alternator + using existing HTML idiom)

The idiom seems to apply to media files a lot, so bringing in rel=enclosure makes sense here. At the HTML level rel="alternate" is used for stating alternatives (normally on a <link>, but <link> and <a> have the same semantic), and type is applied to the links as a MIME type.

http://www.w3.org/TR/html4/struct/links.html#h-12.3

If you are listing alternatives, use a list

So for your examples, a possible model would be (OL is used to express ordered preference)

<ol class="alternates">
 <li><a href="example.mp3" rel="enclosure alternate" type="audio/mpeg">MP3 alternative</a></li>
 <li><a href="example.wav" rel="enclosure alternate" type="audio/wav">WAV alternative</a></li>
 <li><a href="example.mov" rel="enclosure alternate" type="video/quicktime">MOV alternative</a></li>
</ol> 

Following the links syntax, language alternatives can be expressed too (UL indicates no preference in order):

<ul class="alternates">
 <li><a href="enexample.mp3" rel="enclosure alternate" type="audio/mpeg" hreflang="en">In English</a></li>
 <li><a href="esexample.mp3" rel="enclosure alternate" type="audio/mpeg" hreflang="es">En Espagnol</a></li>
 <li><a href="deexample.mp3" rel="enclosure alternate" type="audio/mpeg" hreflang="de">Auf Deutsch</a></li>
 </ul> 

Discussion

Kevin Marks: I think this retains what you have, and brings it back in line with existing HTML practices. I have a stylistic nitpick about 'alternates' rather than 'alternatives' but as HTML has already gone the other way on that I can concede it. Is class="alternates" distinct enough to prevent false positives in looking for this structure?

DrErnie: What if there is no existing attribute for selecting against? Say I have both hi-res and low-res versions of a QuickTime movie available for streaming? Is there any appropriate way to hint/label that?

Kevin Marks: For streaming, I'd say use the built-in QuickTime Alternates mechanism that relies on detected bandwidth. I'd also say "don't use streaming, use fast-start download", and give the users a visible choice about which one to download (see The Cars trailer for one set of options).

Andy Mabbett: "alternates" is an appaling name. If "alternatives" can't be used, what about "choice"?

Toby Inkster: The problem with this proposal is that rel="alternate" already has an established meaning in HTML, and this usage is a mismatch with that predefined semantic. The HTML 4.01 recommendation says that it "designates substitute versions for the document in which the link occurs". That is according to the spec, the media files in the above example are alternative versions of the document itself. (As "being an alternative version" is a transitive relationship, they will also be alternative versions of each other.) In some cases this might actually be true, but in many it will not.

See Also