Loading ...
Sorry, an error occurred while loading the content.

Re: [jslint] JavaScript URLs

Expand Messages
  • Julien R
    I ve already asked Douglas this question before, and I know that JsLint has to hurt my feelings, but I don t understand the need for this check. For a
    Message 1 of 2 , Apr 21 8:03 AM
    View Source
    • 0 Attachment
      I've already asked Douglas this question before, and I know that
      JsLint has to hurt my feelings, but I don't understand the need for
      this check.

      For a dynamically generated link bound to a JavaScript function (via a
      "click" event handler which prevents the default action),
      "javascript:;" is in my opinion a better solution than the ubiquitous
      "#" href.

      "#" doesn't identify the target of my JavaScript link. It gives an
      erroneous information to the user (in the status bar or in the list of
      hyperlinks rendered by a screenreader) and will have an unexpected
      behaviour if:
      - The link is put in a bookmark.
      - The link is opened in a new window or tab.
      - The event handler fails (throws an exception).
      - ...

      On 18/04/2008, Douglas Crockford <douglas@...> wrote:
      > JSLint now rejects a string that starts with 'javascript:'. It
      > previously rejected a string that contained 'javascript:'.
      >
      > Thanks to Timo.
    Your message has been successfully submitted and would be delivered to recipients shortly.