Re: change proposal for <main>: possible validation warning heuristic for misuse

On 1 December 2012 22:19, Maciej Stachowiak <mjs@apple.com> wrote:
> This would end up documenting the semi-mythical "Scooby Doo algorithm" for
> cases when the <main> element is absent.


>From what I understand, the Scooby Doo algorithm concept was derived from
section '4.13.1 The main part of the content' of the spec. It was named and
further elucidated by bruce lawson [2] . Mike Taylor produced a script
based on the concept [3]

today I created a bookmarklet from the script (adds a dashed border and
yellow background to what it identifies as the main content)

Scooby Doo<javascript:(function(){var%20kids=[].slice.apply(document.body.children);for(var%20i=0,l=kids.length;i<l;i++){switch(kids[i].tagName.toLowerCase()){case"header":case"nav":case"aside":case"footer":break;default:kids[i].style.cssText='border:6px%20dashed%20green%20!important;%20background:yellow%20!important;';break;}break;}})()>

and tested it out on a hundred or so of the pages using <!DOCTYPE html> [4]
I found that in approximately 95% of cases the algorithm identified the
main content as either including all of the page content or an element at
the very start of the page. In other words it is of little to no use in
determining either what the main content consists of or where it starts.

I think a much more useful algorithm would take into account id values
commonly used to identify the main content.

[1] http://dev.w3.org/html5/spec/links.html#the-main-part-of-the-content
[2] http://www.brucelawson.co.uk/2012/scooby-doo-content-element/
[3] http://pastie.org/4663081
[4] http://www.html5accessibility.com/tests/HTML5-main-content/

regards
SteveF

Received on Tuesday, 4 December 2012 23:34:41 UTC