Warning: a space character should precede the '/' character.

Discussion about HTML and XHTML related issues.
Post Reply
RogerLee
Rank 0 - Newcomer
Rank 0 - Newcomer
Posts: 2
Joined: Mon Dec 05, 2011 1:07 pm

Warning: a space character should precede the '/' character.

Post by RogerLee » Mon Dec 05, 2011 1:25 pm

Hi!

I recently validated a page from my site using CSE HTML Validator and found many warnings saying:
"For better backward compatibility with HTML, a space character should precede the '/' character."

When I investigated, I found that warnings were coming from a (WP) plugin written by a famous coder.
When I tuned the code (adding a space where needed) and re-validated, warnings were all gone :-)

As I thought it could be helpful to tell the author what I did, I sent the message (excerpt) below:
"....Just to tell you that I did a very small tuning...
I added a blank (space) before the last backslash of Meta Description like here: ( $metadesc ) ) )."' />\n";
Nothing important at all but ....I thought it might help if I let you know even if it is such a small detail...."


Then a day later, I got the following answer from the developer:
"Sorry but that's just nonsense. There's nothing in the HTML spec that requires that space. Cheers,"

Do you have any opinion about that?
Would anyone have a link to W3.org or other entity talking about that?

THANK YOU for your feedback and advises :-)
Roger

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3397
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: Warning: a space character should precede the '/' charac

Post by Albert Wiersch » Mon Dec 05, 2011 4:12 pm

Hi Roger,

It's true that this is not required in the specification, and newer browsers should not have a problem with no space before the '/' in minimized start-tags. However, older browsers (and they'd probably have to be fairly ancient by today's standards) may or may not be confused by this, hence the warning to 'play it safe' and add the space. The only downside I can see to this is the slightly increased size of the document.

This brings up an interesting question as to how big of an issue this is nowadays. Perhaps this should be relegated to a 'legacy' message. I will make a note to consider relegating this to a 'legacy' message for a future update.

Does anyone have any thoughts or comments on this?

Thank you.
Image
Albert Wiersch

RogerLee
Rank 0 - Newcomer
Rank 0 - Newcomer
Posts: 2
Joined: Mon Dec 05, 2011 1:07 pm

Re: Warning: a space character should precede the '/' charac

Post by RogerLee » Tue Dec 06, 2011 9:47 am

Thank you Albert!
Your feedback is much appreciated.

My opinion is that we are never too cautious but maybe I'm the kind of guy who likes an even too perfect code :-)
For the moment I will keep the space as I am used to it, but you're right, maybe in the future this could be relegated to a 'legacy' message.
Thanks again and keep up the good work!

Cheers!
Roger

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3397
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: Warning: a space character should precede the '/' charac

Post by Albert Wiersch » Wed Dec 07, 2011 8:15 pm

I did a little further research. I thought I remembered this discussed in an old (2000/2002) W3C recommendation and it must have been this:
http://www.w3.org/TR/xhtml1/#C_2

It recommends (but doesn't require) the space for HTML compatibility. The space caused some old browsers to treat the slash as an invalid (and thus ignored) attribute, otherwise it might be considered part of the attribute/value pair.

At this current time, however, I think that it is obsolete and is more a matter of style, so I've decided to make sure this option is disabled by default for all new installations.
Image
Albert Wiersch

Post Reply