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

Generated JavaScript Causes HTML Page to Contain Illegal HTML

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.3.0 Release
    • Fix Version/s: 1.3.1 Release
    • Component/s: JavaScript
    • Labels:
      None
    • Environment:

      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

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

              Dates

              • Created:
                Updated:
                Resolved: