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

[jslint] Re: JSLint doesn't like escaped newlines?

Expand Messages
  • jameswcryer
    A good point well made, and yes we re using YUICompressor. Cheers, James.
    Message 1 of 4 , Dec 23, 2009
    • 0 Attachment
      A good point well made, and yes we're using YUICompressor.
      Cheers, James.

      --- In jslint_com@yahoogroups.com, "Michael S. Mikowski" <z_mikowski@...> wrote:
      >
      > I have found the following style construct:
      >
      > var htmlstring;
      >
      > ...
      >
      > htmlstring
      > = '<h1>Title</h1>'
      > + '<p>'
      > + 'Some text'
      > + '</p>'
      > ;
      >
      > preferential for at least two reasons:
      >
      > 1) When you use a compressor, like YUICompressor (you /are/ compressing your
      > code, right?), the string is concatenated for you, so this actually takes up
      > less space than the escaped carriage returns; and
      >
      > 2) It is more readable without a performance penalty, as indentations are
      > stripped during compression.
      >
      > Cheers, Mike
      >
      >
      > On Monday 21 December 2009 03:37:59 pm Douglas Crockford wrote:
      > > --- In jslint_com@yahoogroups.com, "jameswcryer" <emailthejames@> wrote:
      > > > var htmlstring = '\
      > > > <h1>Title</h1>\
      > > > <p>\
      > > > Some text\
      > > > </p>';
      > > >
      > > > Unfortunately the online JSLint app doesn't like this syntax, it provides
      > > > the following error:
      > > >
      > > > Problem at line 1 character 20: Bad escapement.
      > > >
      > > > var htmlstring = '\
      > > >
      > > > May I ask if there is a reason for this or perhaps a limitation of the
      > > > given UI?
      > >
      > > It is not allowed by the third edition of the standard.
      > >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.