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

Final backslash to wrap strings seems unsupported by JSLint

Expand Messages
  • bluflonalgul
    Hi there, I m using a multi line string to initialise a property, something like cssRules: blabla blabla blabla blabla JS works fine but JSLint
    Message 1 of 3 , Feb 19, 2011
    • 0 Attachment
      Hi there,

      I'm using a multi line string to initialise a property, something like

      cssRules: '\

      blabla blabla \

      blabla blabla \

      '

      JS works fine but JSLint doesn't seem to understand the final \ which
      make the string literal wrap :


      Problem at line 173 character 13: Unexpected '\'.

      cssRules: '\

      Problem at line 173 character 11: Unclosed string.

      cssRules: '\




      What do you think of this ?

      Thanks




      [Non-text portions of this message have been removed]
    • Douglas Crockford
      ... I think you should take JSLint s advice and avoid error-prone forms.
      Message 2 of 3 , Feb 19, 2011
      • 0 Attachment
        --- In jslint_com@yahoogroups.com, "bluflonalgul" <bluflonalgul@...> wrote:
        > I'm using a multi line string to initialise a property, something like
        >
        > cssRules: '\
        >
        > blabla blabla \
        >
        > blabla blabla \
        >
        > '
        >
        > JS works fine but JSLint doesn't seem to understand the final \ which
        > make the string literal wrap :
        >
        >
        > Problem at line 173 character 13: Unexpected '\'.
        >
        > cssRules: '\
        >
        > Problem at line 173 character 11: Unclosed string.
        >
        > cssRules: '\
        >
        >
        >
        >
        > What do you think of this ?

        I think you should take JSLint's advice and avoid error-prone forms.
      • bluflonalgul
        ... Well... I haven t seen any piece of advice about how to write long strings. I ve tried different syntaxes and each has its own drawbacks and is prone to
        Message 3 of 3 , Feb 19, 2011
        • 0 Attachment
          --- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@...> wrote:
          >
          >
          > I think you should take JSLint's advice and avoid error-prone forms.
          >

          Well... I haven't seen any piece of advice about how to write long strings.
          I've tried different syntaxes and each has its own drawbacks and is prone to errors.
          The final backslash seems a bit less error-prone than the others, but maybe you have a suggestion about that ?
        Your message has been successfully submitted and would be delivered to recipients shortly.