I am trying to make a website WCAG compliant and read quite a lot about it but still one question remains:
If the document has HTML errors, would it be considered WCAG 2.0 AA compliant?
Following is the report generated by Total Validator. It has 2 diff sections. 1 for HTML errors and other for WCAG errors. Does it mean that if there are HTML errors and WCAG errors, the document would be WCAG compliant?
It is HTML 4, by the way.
HTML errors as such do not count as a violation of WCAG 2.0, though for various constructs, WCAG 2.0 may impose requirements that coincide with requirements in HTML specifications.
If WCAG 2.0 required conformance to HTML specifications, it would have to cite normatively some specific version(s) of some specific HTML specification(s) (thereby causing harmful rigidity) or use loose language, making WCAG 2.0 itself a very moving target (its content would vary, as HTML specifications are changed).
However, Guideline 4.1 (Compatible: Maximize compatibility with current and future user agents, including assistive technologies) requires that “elements have complete start and end tags, elements are nested according to their specifications, elements do not contain duplicate attributes, and any IDs are unique, except where the specifications allow these features”.
In this sense, some syntactic rules need to be obeyed in order to conform to WCAG 2.0. The scope of this requirement is rather vague, since HTML rules vary by language version, and the wording is somewhat strange an arbitrary-looking. For example, it does not forbid undefined elements, undefined attributes, attribute values that violate (some) HTML specifications, or anything that might be classified as “semantically wrong”. It is far from evident whether e.g. <a href=...><h2>...</h2></a> would violate WCAG 2.0: it is invalid nesting according to HTML 4 but allowed in HTML5 CR.
This differs from WCAG 1.0, which had a a general requirement about using W3C technologies and specifically avoiding deprecated HTML features. It is fair to assume that the change is intentional: WCAG 2.0 conformance criteria intentionally do not include conformance to some HTML specification(s)
Related
W3C's HTML5.2 specification merged with WHATWG's HTML Standard.
https://www.w3.org/blog/news/archives/7753
Here, I noticed what was left out of the WHATWG specification, such as outline algorithms that were incomplete in W3C, rb, and rtc elements, and those that were deleted. This is a question about the outline algorithm.
Question
In W3C HTML5.2, the following warning clearly indicated that the outline algorithm was theoretical in specification. As a result, I learned that the browser did not implement the outline algorithm.
There are currently no known native implementations of the outline algorithm in graphical browsers or assistive technology user agents, although the algorithm is implemented in other software such as conformance checkers and browser extensions. Therefore the outline algorithm cannot be relied upon to convey document structure to users. Authors should use heading rank (h1-h6) to convey document structure.
ref --- https://www.w3.org/TR/html52/sections.html#creating-an-outline
However, no such section or warning was found in the WHATWG HTML Standard.
Does this indicate that the browser has a complete outline algorithm implemented? Or are the outline algorithms and hgroup elements still incompatible with browsers and are the specifications incomplete?
They are still not supported by browsers (besides the default styling of H1 elements). There is an issue against the WHATWG specification on GitHub (https://github.com/whatwg/html/issues/83) and several attempts to fix it, but none of them has succeeded yet.
Granted, this is a very generic question, but I am wondering if w3c validation is considered a best practice for html validation, or if there are better approaches to ensure contemporary standards-compliant markup.
This question arose when I noticed duplicate IDs on an MDN page (a site I would have assumed would be very strict about its coding practices). It appeared to be an artifact of how they generated the sections of the page.
Curious, I validated the page's code on the w3c validator, and there were various "errors" that suggested that MDN was just ignoring that a certain attribute or value was not valid. Generally, these related to seemingly appropriate uses of rel attributes.
I was left wondering if standards for valid, semantic markup matter less, or if there's a new ideal approach to code validation and standardization than relying on w3c validation.
Maintainer of the current W3C HTML Checker (validator) here. I think it's important to understand the intended purpose of the current HTML checker, which is different from the purpose of the legacy W3C Markup Validator.
The purpose of the checker is documented at https://validator.w3.org/nu/about.html#why-validate:
The core reason to run your HTML documents through a conformance checker is simple: To catch unintended mistakes—mistakes you might have otherwise missed—so that you can fix them.
Beyond that, some document-conformance requirements (validity rules) in the HTML spec are there to help you and the users of your documents avoid certain kinds of potential problems.
There are some markup cases defined as errors because they are potential problems for accessibility, usability, interoperability, security, or maintainability—or because they can result in poor performance, or that might cause your scripts to fail in ways that are hard to troubleshoot.
Along with those, some markup cases are defined as errors because they can cause you to run into potential problems in HTML parsing and error-handling behavior—so that, say, you’d end up with some unintuitive, unexpected result in the DOM
Validating your documents alerts you to those potential problems.
So as far as your question about "are better approaches to ensure contemporary standards-compliant markup", the answer is that it's not an either-or thing; there are a variety of approaches and the W3C HTML Checker is just one of them, and its goal isn't to be the single way to determine anything but instead to just help you catch mistakes you might otherwise miss and that might cause unexpected problems for your users.
As far as ways to get alerted to specific device issues or browser-implementation issues, we don’t have good automated checking tools for that, but a couple of things which are huge help there are:
https://caniuse.com/ — detailed information about the level of support for particular web-runtime features in different browsers, and in different versions of those browsers, and in release of the browsers for mobile devices vs desktop
https://wptdashboard.appspot.com/ — current test results across all major browser engines for dozens of web-runtime features/specs; if https://caniuse.com/ doesn’t have information about a particular feature, you can look through this dashboard and browse to the directory that has tests for that feature, and find whether a browser passes the tests for the feature
But as far as good automated tools we do actually have for checking other things, here are two:
https://validator.w3.org/i18n-checker/ — W3C Internationalization Checker
https://observatory.mozilla.org/ — for doing a security assessment of the content of your site
I recently faced a problem with mentioned above W3C HTML Checker. I respect a huge amount of work that was done by author of this validator, but it did not allow me in any way a tag <script type="text/vbscript" src="file.vbs">. It was said to change type value to empty string, a JavaScript MIME type, or module, which makes my page useless.
I know than VBScript language is rarely used now, it was just a test page, but let me share with you less tricky alternative, as good as the first one for HTML error checking.
Maintainer of the current JsonFormatter (validator) is here
The "old" HTML/XHTML standards have a DTD (Document Type Definition) defined for them:
HTML 4.01 http://www.w3.org/TR/html401/sgml/dtd.html
XHTML 1.0 http://www.w3.org/TR/xhtml1/dtds.html#a_dtd_XHTML-1.0-Strict
This DTDs specify the rules for nesting elements - "which types of elements may appear in which types of elements". I made a diagram for XHTML 1.0 here (sorry, I no longer have that resource)
I would like to update that diagram with a new version which also includes the new HTML5 elements. However, there doesn't seem to be a HTML5 DTD. It seems that the nesting rules are defined by the various content models that are defined in HTML5.
So there is no DTD, correct?
Follow-up question: Is there a reason why there is no DTD in HTML5? The DTD is such a nice method of defining the nesting rules for all the different types of elements. Why wouldn't they include such a thing?
Update: I found this: http://www.w3.org/TR/html5/dom.html#kinds-of-content I guess, this is the closest to having a DTD.
Update: The Visual Studio Team made a XML Schema for XHTML5. I guess that answers my question: Link
There is no HTML5 DTD. The HTML5 RC explicitly says this when discussing XHTML serialization, and this clearly applies to HTML serialization as well.
DTDs have been regarded by the designers of HTML5 as too limited in expressive power, and HTML5 validators (basically the HTML5 mode of http://validator.nu and its copy at http://validator.w3.org/nu/) use schemas and ad hoc checks, not DTD-based validation.
Moreover, HTML5 has been designed so that writing a DTD for it is impossible. For example, there is no SGML way to capture the HTML5 rule that any attribute name that starts with “data-” and complies with certain general rules is valid. In SGML, attributes need to be listed individually, so a DTD would need to be infinite.
It is possible to design DTDs that correspond to HTML5 with some omissions and perhaps with some extra rules imposed, but they won’t really be HTML5 DTDs. My experiment with the idea is not very encouraging: too many limitations, too tricky, and the DTD would need to be so permissive that many syntax errors would go uncaught.
Correct. There is no DTD. However, HTML5 documents should start with <!DOCTYPE html>
So there's a DOCTYPE, but no DTD.
See:
http://dev.w3.org/html5/spec/syntax.html#the-doctype
http://en.wikipedia.org/wiki/Document_Type_Declaration#HTML5_DTD-less_DOCTYPE
I have created an HTML5 DTD for use in my PHP XML projects. It ain't beautiful, but it works with well-formed XHTML5 (that is, HTML5 expressed as XML).
You can grab it from my bitbucket account here:
https://bitbucket.org/kashbridge/dtd/overview
Enjoy!
Certain Marcus from sgmljs.net created and analyzed an SGML DTD for HTML 5.1 and started a thread in the XML-DEV mailing list for review and discussion. The discussion revolves around entity definitions so far.
I've just completed my analysis of W3C's HTML 5.1 recommendation at
http://sgmljs.net/docs/html5.html (from a markup language rather than
web development PoV), and I'm publishing it here for review in the
form of an initial SGML DTD for parsing HTML 5.1, along with a lengthy
analysis text.
[…]
I'm aware that WHATWG and W3C have since long moved away from SGML
(and XML in most web-related specification work), treating it as a
legacy technique and with a somewhat presumptuous attitude in the
specification text and elsewhere. But as the analysis of HTML5's
grammar shows, they've essentially abandoned use of any formal methods
alltogether (and it shows in at least two flaws discussed in the
analysis).
Nothing official yet, but maybe this initiative will get traction, or at least find its users as an unofficial resource.
I think they did away with the old DTDs, now we just start HTML pages with: <!DOCTYPE HTML>
Maybe the W3C will come out with one eventually.
There are many questions here, like this one, asking about attributes that not are defined in the HTML5 spec. All the HTML+RDFa attributes, like vocab, typeOf and property, are "valid by default", without necessity of an namespace mechanism.
So, the problem: if it is a "valid HTML5" attribute (or element), and it is not in the HTML5 spec, how can I (or my algorithm) know that it is valid?
There are another W3C spec saying "hello, this is a list of current specifications that are affected by other current specifications" (mutually affected specs)?
NOTES
Perhaps W3C uses some principle as
"ignorantia legis neminem excusat" (Latin for "ignorance of the law excuses no one") of the
Civil law countries (?)... So, in this case, W3C have obligation to show that "list of mutually affected specs" above.
The context here have no specific Stackoverflow-tags. Is something like "interoperating standards" or "agreement between W3C specifications of the same group"... or "inter-spec recommendations".
This question goes to the heart of what it means for a document to be "valid". Although we, in common parlance talk of validity, the HTML5 spec does not actually use the term "valid" but "conformance". That is, it says that an HTML document conforms or does not conform to the specific requirements laid out in the specification. It also says something about extensibility which is very illuminating:
When vendor-neutral extensions to this specification are needed,
either this specification can be updated accordingly, or an extension
specification can be written that overrides the requirements in this
specification. When someone applying this specification to their
activities decides that they will recognise the requirements of such
an extension specification, it becomes an applicable specification for
the purposes of conformance requirements in this specification.
Note: Someone could write a specification that defines any arbitrary byte
stream as conforming, and then claim that their random junk is
conforming. However, that does not mean that their random junk
actually is conforming for everyone's purposes: if someone else
decides that that specification does not apply to their work, then
they can quite legitimately say that the aforementioned random junk is
just that, junk, and not conforming at all. As far as conformance
goes, what matters in a particular community is what that community
agrees is applicable.
What that means is that whether an element or attribute is valid or not is not absolute but depends on the community that wishes to apply specific rules or not. So it is with the RDFa attributes: they're valid if you want them to be, not if you don't. Within the wider community, what elements are considered valid can change over time. If RDFa falls out of use, then they will be effectively invalid. If RDFa grows in popularity, then those attributes become valid to a wider community.
So, its effectively meaningless to talk of a document that defines which current specs form a full set of validity requirements. The set necessarily depends on any extant specs that are accepted as defining validity for each community.
I have website templates and want to validate its HTML. I've heard that there is a w5 or something like that, I don't remember the validator to check HTML errors. So can anyone post me a link of that?
http://validator.w3.org/ This is the standard.
This checks the markup validity of Web documents in HTML, XHTML, SMIL,
MathML, etc.
For things like CSS validity you should take a look at: http://jigsaw.w3.org/css-validator/
The website you are looking for is W3 Markup Validation Service (http://validator.w3.org/). The W3 stands for World Wide Web.
This depends on what you expect validation to be. The W3C Markup Validation Service http://validator.w3.org/ is the usual answer, but it answers a question different from what people usually mean when they ask for validation.
It is originally based on the SGML concept of validation, which is a purely formal process and does not check for correctness in general, only syntax rules specified in a formalized way. In addition to detecting actual markup errors, it issues messages about violations of formal syntax that do no harm in any browser (e.g. title=Hello! without quotation marks) and accepts constructs that do not work in any browser (say <em/Hello). More info: “HTML validation” is a good tool, but just a tool.
The W3C Markup Validation Service isn’t really a pure SGML validator (or a pure XML validator) but has some checks and warnings beyond that. There’s a more pure SGML validator: WDG HTML Validator.
When processing a document declared as HTML5, using <!DOCTYPE html>, the W3C Markup Validation Service changes it nature: it becomes an ad hoc checker for specifically HTML5, behaving rather differently from an SGML validator. It is described as experimental, and it does not necessarily correspond to the most recent version or HTML5 (or of “HTML Living Standard”). Technically it is based on Validator.nu Living Validator.
With very small exceptions, these services do not check for the correctness of embedded or linked CSS and JavaScript at all, or links, semantic correctness, usability, accessibility, etc. So a “valid” page may look complete mess and fail to work at all.
There is also software marketed as “HTML validator” (as you can find out by googling), typically performing a large set of heuristic checks, partly based on HTML specifications, partly on other specs, and partly by software vendor’s own ideas of what is correct.