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

Dom html...

Expand Messages
  • santini.alberto
    I have a code snippet containing: ... if (!(contents instanceof HTMLElement)) { ... Of course JSLint says HTMLElement is undefined. Same message with browser
    Message 1 of 2 , Sep 20, 2008
    View Source
    • 0 Attachment
      I have a code snippet containing:

      ...
      if (!(contents instanceof HTMLElement)) {
      ...

      Of course JSLint says

      'HTMLElement' is undefined.

      Same message with browser option activated.

      My workaround is to use /*globals HTMLElement */, but I was wondering
      if it is the correct approach.

      Thanks in advance,
      Alberto Santini
    • Douglas Crockford
      ... Yes it is. HTMLElement is not found in all browsers, so it is usually good to get the warning.
      Message 2 of 2 , Sep 20, 2008
      View Source
      • 0 Attachment
        --- In jslint_com@yahoogroups.com, "santini.alberto"
        <albertosantini@...> wrote:
        >
        > I have a code snippet containing:
        >
        > ...
        > if (!(contents instanceof HTMLElement)) {
        > ...
        >
        > Of course JSLint says
        >
        > 'HTMLElement' is undefined.
        >
        > Same message with browser option activated.
        >
        > My workaround is to use /*globals HTMLElement */, but I was wondering
        > if it is the correct approach.

        Yes it is. HTMLElement is not found in all browsers, so it is usually
        good to get the warning.
      Your message has been successfully submitted and would be delivered to recipients shortly.