By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,574 Members | 1,459 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,574 IT Pros & Developers. It's quick & easy.

Reverse Solidus (Backslash) Necessary?

P: 9
I am using strict HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
in my website. validator.w3c.org gives me lots of errors within my javascript code, such as:
'<B>a</B>...Line 24, Column 40: end tag for element "B" which is not open'

The validator does not recognize the start tag <B>, just the end tag </B>.

I have 4 possible fixes for this problem:
1. Back off to the provisional HTML (but why bother? - browsers work just fine with my code.)
2. Add the reverse solidus (backslash \) to the javascript end tags by replacing </ with <\/ in the javascript portions of my HTML (javascript treats "\/" just like "/". I'm not eager to do this - I have hundreds of pages of code, and I mix HTML with javascript on the same pages.)
3. Put the javascript in a separate file (again , I don't want to do this because of all the extra work.)
4. Ignore the validation errors (isn't this just a result of a buggy validator not recognizing the start tags?)

Is there a downside to ignoring the validation errors? Please let me have your thoughts.
Feb 8 '12 #1
Share this Question
Share on Google+
1 Reply


Dormilich
Expert Mod 5K+
P: 8,639
validator.w3c.org gives me lots of errors within my javascript code, such as:
'<B>a</B>...Line 24, Column 40: end tag for element "B" which is not open'
then it's best to move the script to an external file and include it. this way it is never touched by the HTML parser/validator.
Feb 8 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.