Re: tweet and pin button attributes failing validation

Giganews Newsgroups
Subject: Re: tweet and pin button attributes failing validation
Posted by:  Jukka K. Korpela (jkorpe…@cs.tut.fi)
Date: Mon, 08 Apr 2013

2013-04-08 16:19, lipska the kat wrote:

> I'm trying to get the site to pass w3
> validation but I'm falling over with the organization specific
> attributes, the attributes concerned are
>
> data-via, data-dnt, data-text, data-url, count-layout

Such attributes are not allowed by any published DTD for HTML. Apart
from the last one, they are all allowed in HTML5 CR, which allows almost
any attribute that starts with "data-" to be used for site-specific
scripting (and styling) purposes, see
http://www.w3.org/TR/html5/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes

> How do you pass validation when you have non-standard attributes in an
> href?

I don't see how href relates to this; href is an attribute, not an element.

Anyway, the way to "validate" a document with "data-" attributes (in any
element) is to usehttp://validator.w3.org orhttp://validator.nu in
HTML5 mode. You trigger that mode by using

<!doctype html>

at the very start, instead of any other doctype string, or,
alternatively, by selecting HTML5 from the dropdown in the validators'
user interface.

Caveats:
1. HTML5 is work in progress.
2. There is no published document that specifies which variant of HTML5
is actually used by the validators in HTML5 mode. It seems that it's
whatever its authors regard as "current".
3. The validators have (other) bugs, too.
4. Validation is just checking and as such does not improved your page
the least. What matters is that you might find some errors that you can
then fix. So the purpose of validation is to get error messages and
warnings, not to get a "clean report"!

--
Yucca,http://www.cs.tut.fi/~jkorpela/

Replies

In response to

tweet and pin button attributes failing validation posted by lipska the kat on Mon, 08 Apr 2013