Reputation: 30136
I'm parsing the source code of different web pages.
I'm not sure whether or not it is guaranteed that it will always be in HTML format, but for the sake of this question, it is all I'm interested in (i.e., you can assume that my question refers to HTML pages).
Now, I read the standard for XML and XHTML, stating that the value of every attribute, whether it's numeric or not, has to be quoted (encapsulated with "
).
But I have not been able to find this issue on the HTML standard.
If I remember correctly, numeric values are not necessarily quoted.
What about non-numeric values? Can I assume that they are always quoted?
Thanks
Upvotes: 0
Views: 77
Reputation: 74078
The HTML standard doesn't require attributes to be quoted, see HTML5 - The HTML syntax - Attributes
8.1.2.3 Attributes
...
Attributes can be specified in four different ways:
Empty attribute syntax
Unquoted attribute value syntax
Single-quoted attribute value syntax
Double-quoted attribute value syntax
Upvotes: 2