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

Re: Node not defined

Expand Messages
  • douglascrockford
    ... Can you please cite the relevant standard?
    Message 1 of 7 , Oct 18, 2012
    • 0 Attachment
      --- In jslint_com@yahoogroups.com, Ian Toltz <itoltz@...> wrote:

      > I get the error
      >
      > 'Node' was used before it was defined.
      >
      > From the line:
      >
      > if (nodes[i].nodeType === Node.TEXT_NODE) {
      >
      > I do have the "Assume a browser" option on.
      >
      > I believe this to be in error, as Node is one of the pre-defined objects in
      > JS (at least in a browser, not sure if that's the case in other
      > environments) like Math.

      Can you please cite the relevant standard?
    • Joshua Bell
      ... Since the original poster hasn t replied: http://www.w3.org/TR/DOM-Level-3-Core/core.html That spec - which so far as I know is implemented by all the
      Message 2 of 7 , Oct 22, 2012
      • 0 Attachment
        On Thu, Oct 18, 2012 at 12:03 AM, douglascrockford <douglas@...>wrote:

        > **
        >
        >
        > --- In jslint_com@yahoogroups.com, Ian Toltz <itoltz@...> wrote:
        >
        > > I get the error
        > >
        > > 'Node' was used before it was defined.
        > >
        > > From the line:
        > >
        > > if (nodes[i].nodeType === Node.TEXT_NODE) {
        > >
        > > I do have the "Assume a browser" option on.
        > >
        > > I believe this to be in error, as Node is one of the pre-defined objects
        > in
        > > JS (at least in a browser, not sure if that's the case in other
        > > environments) like Math.
        >
        > Can you please cite the relevant standard?
        >
        >
        Since the original poster hasn't replied:

        http://www.w3.org/TR/DOM-Level-3-Core/core.html

        That spec - which so far as I know is implemented by all the current
        browsers - introduces a rather large number of new global objects into the
        browser. And that spec is not alone, given the rapid pace of browser
        evolution at the moment.

        A quick and non-authoritative check using a handy browser, stripping
        vendor-specific types, I'm getting around 351 global functions that look
        like constructors. Of those, 69 are HTML types, 142 are SVG types, 22 are
        WebGL/TypedArray types, 13 are CSS types, 26 are Event types, and so
        on. That's a significant number, but for better or worse it does fairly
        accurately represent the surface area of the "browser" API available to
        scripts at the moment.

        If you'd find it helpful, I can pull together a list for you, categorized
        by spec.


        [Non-text portions of this message have been removed]
      • Felix E. Klee
        On Mon, Oct 22, 2012 at 6:20 PM, Joshua Bell ... They should all be accessible via the `window` object, or am I missing something?
        Message 3 of 7 , Oct 22, 2012
        • 0 Attachment
          On Mon, Oct 22, 2012 at 6:20 PM, Joshua Bell <inexorabletash@...>
          wrote:
          > [...] introduces a rather large number of new global objects into the
          > browser.

          They should all be accessible via the `window` object, or am I missing
          something?
        • Felix E. Klee
          ... Any reason why you don t use `window.Node.TEXT_NODE`?
          Message 4 of 7 , Oct 22, 2012
          • 0 Attachment
            On Tue, Oct 16, 2012 at 9:38 PM, Ian Toltz <itoltz@...> wrote:
            > if (nodes[i].nodeType === Node.TEXT_NODE) {

            Any reason why you don't use `window.Node.TEXT_NODE`?
          • douglascrockford
            ... That document describes a rather large number of interfaces, which may be interesting in the abstract because JavaScript, as you know, does not have
            Message 5 of 7 , Oct 22, 2012
            • 0 Attachment
              --- In jslint_com@yahoogroups.com, Joshua Bell <inexorabletash@...> wrote:
              >
              > On Thu, Oct 18, 2012 at 12:03 AM, douglascrockford <douglas@...>wrote:
              >
              > > **
              > >
              > >
              > > --- In jslint_com@yahoogroups.com, Ian Toltz <itoltz@> wrote:
              > >
              > > > I get the error
              > > >
              > > > 'Node' was used before it was defined.
              > > >
              > > > From the line:
              > > >
              > > > if (nodes[i].nodeType === Node.TEXT_NODE) {
              > > >
              > > > I do have the "Assume a browser" option on.
              > > >
              > > > I believe this to be in error, as Node is one of the pre-defined objects
              > > in
              > > > JS (at least in a browser, not sure if that's the case in other
              > > > environments) like Math.
              > >
              > > Can you please cite the relevant standard?
              > >
              > >
              > Since the original poster hasn't replied:
              >
              > http://www.w3.org/TR/DOM-Level-3-Core/core.html
              >
              > That spec - which so far as I know is implemented by all the current
              > browsers - introduces a rather large number of new global objects into the
              > browser. And that spec is not alone, given the rapid pace of browser
              > evolution at the moment.


              That document describes a rather large number of interfaces, which may be interesting in the abstract because JavaScript, as you know, does not have interfaces.

              Can you please identify a standard that makes these things global or properties of the window object?
            • Joshua Bell
              ... That would be the ECMAScript binding of WebIDL: http://dev.w3.org/2006/webapi/WebIDL/#ecmascript-binding Web standards typically define IDL fragments and
              Message 6 of 7 , Oct 22, 2012
              • 0 Attachment
                On Mon, Oct 22, 2012 at 9:53 AM, douglascrockford <douglas@...>wrote:

                > **
                >
                >
                > --- In jslint_com@yahoogroups.com, Joshua Bell <inexorabletash@...> wrote:
                > >
                > > On Thu, Oct 18, 2012 at 12:03 AM, douglascrockford <douglas@...>wrote:
                > >
                > > > **
                >
                > > >
                > > >
                > > > --- In jslint_com@yahoogroups.com, Ian Toltz <itoltz@> wrote:
                > > >
                > > > > I get the error
                > > > >
                > > > > 'Node' was used before it was defined.
                > > > >
                > > > > From the line:
                > > > >
                > > > > if (nodes[i].nodeType === Node.TEXT_NODE) {
                > > > >
                > > > > I do have the "Assume a browser" option on.
                > > > >
                > > > > I believe this to be in error, as Node is one of the pre-defined
                > objects
                > > > in
                > > > > JS (at least in a browser, not sure if that's the case in other
                > > > > environments) like Math.
                > > >
                > > > Can you please cite the relevant standard?
                > > >
                > > >
                > > Since the original poster hasn't replied:
                > >
                > > http://www.w3.org/TR/DOM-Level-3-Core/core.html
                > >
                > > That spec - which so far as I know is implemented by all the current
                > > browsers - introduces a rather large number of new global objects into
                > the
                > > browser. And that spec is not alone, given the rapid pace of browser
                > > evolution at the moment.
                >
                > That document describes a rather large number of interfaces, which may be
                > interesting in the abstract because JavaScript, as you know, does not have
                > interfaces.
                >
                > Can you please identify a standard that makes these things global or
                > properties of the window object?
                >
                >
                That would be the ECMAScript binding of WebIDL:

                http://dev.w3.org/2006/webapi/WebIDL/#ecmascript-binding

                Web standards typically define IDL fragments and by reference to WebIDL,
                interfaces in these fragments are exposed as properties of the ECMAScript
                environment.


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