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

Bug report: access of character in string by index

Expand Messages
  • Chris
    Hello, Line 1786 of fulljslint.js is part of an attempt to detect and validate the closing of an HTML comment: -- . It reads as: if (s[i + 2] !== ) {
    Message 1 of 3 , Nov 17, 2010
    • 0 Attachment
      Hello,

      Line 1786 of fulljslint.js is part of an attempt to detect and validate the closing of an HTML comment: -->.

      It reads as:

      if (s[i + 2] !== '>') {

      https://github.com/douglascrockford/JSLint/blob/ca120a731db548c0014320fa0c196edc613536ae/fulljslint.js#L1786

      Where "s" is a string. Unfortunately, this method of accessing a specific character of a string by its index is not universally supported. In particular, I find that it is failing in WSH.

      Would you mind adjusting this to use the charAt method instead?

      Thanks!

      - Chris
    • Douglas Crockford
      ... Please try it now.
      Message 2 of 3 , Nov 17, 2010
      • 0 Attachment
        --- In jslint_com@yahoogroups.com, "Chris" <Nielsen.Chris@...> wrote:
        > Line 1786 of fulljslint.js is part of an attempt to detect and validate the closing of an HTML comment: -->.
        >
        > It reads as:
        >
        > if (s[i + 2] !== '>') {
        > https://github.com/douglascrockford/JSLint/blob/ca120a731db548c0014320fa0c196edc613536ae/fulljslint.js#L1786
        >
        > Where "s" is a string. Unfortunately, this method of accessing a specific character of a string by its index is not universally supported. In particular, I find that it is failing in WSH.
        >
        > Would you mind adjusting this to use the charAt method instead?

        Please try it now.
      • Chris
        ... This works fine, thank you!
        Message 3 of 3 , Nov 17, 2010
        • 0 Attachment
          --- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@...> wrote:
          > >
          > > Would you mind adjusting this to use the charAt method instead?
          >
          > Please try it now.
          >

          This works fine, thank you!
        Your message has been successfully submitted and would be delivered to recipients shortly.