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

DOM classes undefined

Expand Messages
  • Daniel Cassidy
    Hi, With assume browser turned on, JSLint rejects the following: if (n instanceof Document) { // Document is undefined // ... } Shouldn t the DOM classes
    Message 1 of 4 , Dec 16, 2008
    • 0 Attachment
      Hi,

      With 'assume browser' turned on, JSLint rejects the following:

      if (n instanceof Document) { // 'Document' is undefined
      // ...
      }


      Shouldn't the DOM classes (Document, Element, ...) be defined when
      assuming a browser, or is this intentional?

      Thanks,
      Dan.
    • Douglas Crockford
      ... My understanding is that these are not universally implemented in all browsers, and so represent a portability trap.
      Message 2 of 4 , Dec 16, 2008
      • 0 Attachment
        --- In jslint_com@yahoogroups.com, "Daniel Cassidy" <mail@...> wrote:
        > Shouldn't the DOM classes (Document, Element, ...) be defined when
        > assuming a browser, or is this intentional?

        My understanding is that these are not universally implemented in all
        browsers, and so represent a portability trap.
      • kaichen67@yahoo.de
        ... Try this: alert(document); alert(Document); Javascript is case sensitive!
        Message 3 of 4 , Dec 17, 2008
        • 0 Attachment
          > With 'assume browser' turned on, JSLint rejects the following:

          > if (n instanceof Document) { // 'Document' is undefined
          > // ...
          > }


          > Shouldn't the DOM classes (Document, Element, ...) be defined when
          > assuming a browser, or is this intentional?

          Try this:

          alert(document);
          alert(Document);


          Javascript is case sensitive!
        • mnewton32@yahoo.ca
          Yes, JS is case sensitive; document is referring to a specific object that exists in all browsers, while Document refers to the class that object should be an
          Message 4 of 4 , Dec 17, 2008
          • 0 Attachment
            Yes, JS is case sensitive; document is referring to a specific object that exists in all browsers, while Document refers to the class that object should be an instance of. IE doesn't support those standard DOM classes that the original poster is looking for.

            Sent from my BlackBerry device on the Rogers Wireless Network

            -----Original Message-----
            From: kaichen67@...

            Date: Wed, 17 Dec 2008 21:10:04
            To: <jslint_com@yahoogroups.com>
            Subject: Re: [jslint] DOM classes undefined



            > With 'assume browser' turned on, JSLint rejects the following:

            > if (n instanceof Document) { // 'Document' is undefined
            > // ...
            > }


            > Shouldn't the DOM classes (Document, Element, ...) be defined when
            > assuming a browser, or is this intentional?

            Try this:

            alert(document);
            alert(Document);


            Javascript is case sensitive!






            [Non-text portions of this message have been removed]
          Your message has been successfully submitted and would be delivered to recipients shortly.