Uploaded image for project: 'Commons Validator'
  1. Commons Validator
  2. VALIDATOR-210

Generated JavaScript Causes HTML Page to Contain Illegal HTML

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.3.0 Release
    • 1.3.1 Release
    • JavaScript
    • None
    • All

    Description

      Various JavaScript functions contain JavaDoc comments at the start such as:

      /*$RCSfile: validateMaxLength.js,v $ $Rev: 376673 $ $Date: 2006-02-10 13:42:31 +0000 (Fri, 10 Feb 2006) $ */
      /**

      • A field is considered valid if less than the specified maximum.
      • Fields are not checked if they are disabled.
      • <p>
      • <strong>Caution:</strong> Using <code>validateMaxLength</code> on a password field in a
      • login page gives unnecessary information away to hackers. While it only slightly
      • weakens security, we suggest using it only when modifying a password.</p>
      • @param form The form validation is taking place on.
        */
        function validateMaxLength(form) {

      This causes the W3C tidy application to report the following:

      "<" + "/" + letter not allowed here
      Cause:

      The 2 characters "</" have been detected in a wrong place.
      Solution:

      In most case, this is due to wrong javascript:

      BAD <document.write("</h1>");
      GOOD <document.write("<\/h1>");

      References:

      W3C faq: http://validator.w3.org/docs/help.html#faq-javascript
      HtmlHelp: http://www.htmlhelp.com/tools/validator/problems.html#script

      And thus produces illegal HTML.

      The proposed solution is to remove the offending tags.

      Attachments

        Activity

          People

            niallp Niall Pemberton
            nsherman Neil Sherman
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: