Re: XHTML: there is no attribute "data-...

On Thu, Feb 2, 2017 at 3:48 PM, David Dorward <david@dorward.me.uk> wrote:

On 1 Feb 2017, at 21:28, John wrote:
>
> While validating an XHTML Transitional page I get 2 errors:
> there is no attribute "data-...
>
> data-* attributes were introduced in HTML 5. While there is an XML
> serialisation of HTML 5, there is no “Transitional” variant. The only
> Transitional DTDs are HTML 4.01 Transitional and XHTML 1.0 Transitional
> (they were designed to help people transition from HTML 3.2 presentational
> elements to CSS in the late 90s).
>

What you write is correct, but somewhat confusing in this context. Maybe it
helps to split the issue into parts:

As regards to data-* attributes, XHTML 1.0 just does not allow them. So if
you wish to keep using XHTML 1.0 as the document type, you just need to
ignore the error messages about those attributes (and be extra careful when
writing them, since the validator does not check them).

If you wish to switch to HTML5, which allows those attributes, you can use
the validator but it does not then perform formal validation as used for
previous versions of HTML. The checks will be partly stricter, and they
will check against what is regarded as HTML5 as of today. You will see
error messages and warnings about things that are quite OK in XHTML 1.0
Transitional.

You can use “doctype override” in the user interface to see how HTML5
checks would look like. Under “More Options”, select “HTML5 (experimental)”
in the “Document Type” dropdown.

Yucca

Received on Thursday, 2 February 2017 22:12:07 UTC