"less-than" in attribute value

For technical support for all editions of CSE HTML Validator. Includes bug reports.

"less-than" in attribute value

Postby anionic » Fri Aug 07, 2009 12:04 pm

My XHTML 1.0 handbook says: "WARNING: ... It is illegal to have a less-than character in an attribute value, even if it is encoded using an entity reference." and advises encoding < as &#60;

The W3C free online checker also complains about this (which is how I became aware of this, when a client checked a site we did for them).

How can I configure 9.0 to check for this? Here is a test page:

http://jbgb.com/docs/test1.html
anionic
Rank 0 - Newcomer
Rank 0 - Newcomer
 
Posts: 8
Joined: Wed Oct 31, 2007 12:23 pm
Location: Staffordshire, UK

Re: "less-than" in attrubute value

Postby Albert Wiersch » Fri Aug 07, 2009 4:51 pm

This is interesting. I haven't had this issue come up before. I see from your test page that the W3C validator doesn't like:

Code: Select all
<meta name="author" content="me <grin>" />


...but I am not aware of any real-life situations where it would be a problem, and real-life is important to CSE HTML Validator.

Furthermore, the included DTD based validator in CSE HTML Validator doesn't mind this either, though this may be one of its XHTML limitations.

I also found it hard to find anything on the web about this. Do you have any links?

Unfortunately I cannot think of an easy way to have CSE HTML Validator generate messages for this issue for all attribute values.

I could perhaps add an option to check for this in the next major version of CSE HTML Validator.
Image
Albert Wiersch
User avatar
Albert Wiersch
Site Admin
Site Admin
 
Posts: 2361
Joined: Sat Dec 11, 2004 10:23 am
Location: Near Dallas, TX

Re: "less-than" in attrubute value

Postby Albert Wiersch » Wed Feb 10, 2010 4:15 pm

In the next V10 BETA, this warning message will now be generated for unescaped less-than characters in attribute values in XHTML documents:
Found at least one unescaped less-than character ('<') in an attribute value in an XHTML type document. In XHTML (but not in HTML), less-than characters in attribute values should be escaped with "&lt;" or "&#x3c;". However, no real-world browser or user agent is currently known to have a problem with unescaped less-than characters in attribute values.

Thanks!
Image
Albert Wiersch
User avatar
Albert Wiersch
Site Admin
Site Admin
 
Posts: 2361
Joined: Sat Dec 11, 2004 10:23 am
Location: Near Dallas, TX


Return to CSE Tech Support

Who is online

Users browsing this forum: No registered users and 2 guests

cron