Reverse Solidus (Backslash) Necessary?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • systomx
    New Member
    • Nov 2011
    • 9

    Reverse Solidus (Backslash) Necessary?

    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.o rg 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.
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    validator.w3c.o rg 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.

    Comment

    Working...