When an attribute value can remain unquoted in HTML5

When can attribute value be left without quotes in HTML5?

HTML4.01 is an SGML application. Thus, in HTML4, quotation marks can be omitted if the only characters used in the value are those that are currently declared as name characters: alphanumeric character, full stop, -,:, _.

Well, from the W3C working draft (January 13, 2011):

An attribute value can remain unquoted if it does not contain spaces or any of "'' = <or>.

But if I put any other character except an alphanumeric character in the attribute value, a complete stop, -,:, _ and staying in it without quotes validator.w3.org does not confirm my html document as a valid HTML5 document.

So the question is still open. Is this an HTML5 working draft error or is it an error in validate.w3.org?

+4
source share
3 answers

No, the working draft is in order, and the validator is working correctly.

try it

<!DOCTYPE html> <title>test</title> <div class=%test$></div> 

at http://validator.w3.org/#validate_by_input

The validator is satisfied with both% and $ characters. So what exactly are you testing?

0
source

If you do not insert the xmlns attribute in your html element, rendering the document as XHTML 5 (HTML 5 XML serialization), the use of unquoted values โ€‹โ€‹with the appropriate characters is checked as valid HTML 5.

0
source

Source: https://habr.com/ru/post/1345375/


All Articles