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

Re: [jslint] Cascade format

Expand Messages
  • Tzvika
    Rob But due to semicolon insertion , you will get an error on line 2. ... -- Tzvika Merchav Tel: +972-57-5659548 www.listen.co.il [Non-text portions of this
    Message 1 of 7 , Nov 24 8:48 AM
      Rob

      But due to 'semicolon insertion', you will get an error on line 2.


      On Wed, Nov 24, 2010 at 5:25 PM, Rob Richardson <erobrich@...>wrote:

      >
      >
      > Put the dots at the beginning of the next line rather than at the end of
      > the
      > former line.
      >
      > Rob
      >
      >
      > -----Original Message-----
      > From: jslint_com@yahoogroups.com <jslint_com%40yahoogroups.com> [mailto:
      > jslint_com@yahoogroups.com <jslint_com%40yahoogroups.com>] On
      > Behalf Of James
      > Sent: Wednesday, November 24, 2010 7:45 AM
      > To: jslint_com@yahoogroups.com <jslint_com%40yahoogroups.com>
      > Subject: [jslint] Cascade format
      >
      > In "JavaScript: The Good Parts", page 42, a cascade is formatted very
      > nicely. In my example, I have:
      >
      > var htmlToExamine = returnvalue.
      > replace(/^Success/, "").
      > replace(/^<div id="\w+_table_\d+_book_buttons".*?<\/div>/, "").
      > replace(/<script.*?<\/script>/g, "").
      > replace(/^\s*<[^>]+>\s*/, "").
      > replace(/\s*<\/\w+>\s*$/, "");
      >
      > I like how this looks, lining up the replace method calls. However, JSLint
      > does not like it. Is there an option I'm missing that lets this format be
      > accepted?
      >
      >
      >



      --

      Tzvika Merchav


      Tel: +972-57-5659548
      www.listen.co.il


      [Non-text portions of this message have been removed]
    • Erik Eckhardt
      Rob already answered to put the periods on the next line, but I wanted to point out a potential problem in your regular expressions. The following block could
      Message 2 of 7 , Nov 24 9:09 AM
        Rob already answered to put the periods on the next line, but I wanted to
        point out a potential problem in your regular expressions.

        The following block could end up being completely removed (depending on
        whether your regex engine is being greedy or not) because your script
        removal expression uses .* which can scream right past any opening and
        closing tags in between.

        <script type="text/javascript">function f() {}</script>
        <strong>VERY IMPORTANT HTML CONTENT HERE</strong>
        <script type="text/javascript">function g() {}</script>

        On Wed, Nov 24, 2010 at 6:44 AM, James <jacob@...> wrote:

        >
        >
        > In "JavaScript: The Good Parts", page 42, a cascade is formatted very
        > nicely. In my example, I have:
        >
        > var htmlToExamine = returnvalue.
        > replace(/^Success/, "").
        > replace(/^<div id="\w+_table_\d+_book_buttons".*?<\/div>/, "").
        > replace(/<script.*?<\/script>/g, "").
        > replace(/^\s*<[^>]+>\s*/, "").
        > replace(/\s*<\/\w+>\s*$/, "");
        >
        > I like how this looks, lining up the replace method calls. However, JSLint
        > does not like it. Is there an option I'm missing that lets this format be
        > accepted?
        >
        >
        >


        [Non-text portions of this message have been removed]
      • Erik Eckhardt
        I don t think that s true... I have code with dots on the next line and I don t think jslint complains about it. ... [Non-text portions of this message have
        Message 3 of 7 , Nov 24 10:19 AM
          I don't think that's true... I have code with dots on the next line and I
          don't think jslint complains about it.

          On Wed, Nov 24, 2010 at 8:48 AM, Tzvika <tzvikam@...> wrote:

          > Rob
          >
          > But due to 'semicolon insertion', you will get an error on line 2.
          >
          > On Wed, Nov 24, 2010 at 5:25 PM, Rob Richardson <erobrich@...<erobrich%40robrich.org>
          > >wrote:
          > > Put the dots at the beginning of the next line rather than at the end of
          > > the
          > > former line.
          > >
          > > Rob
          > >
          > > -----Original Message-----
          > > From: jslint_com@yahoogroups.com <jslint_com%40yahoogroups.com><jslint_com%
          > 40yahoogroups.com> [mailto:
          > > jslint_com@yahoogroups.com <jslint_com%40yahoogroups.com> <jslint_com%
          > 40yahoogroups.com>] On
          > > Behalf Of James
          > > Sent: Wednesday, November 24, 2010 7:45 AM
          > > To: jslint_com@yahoogroups.com <jslint_com%40yahoogroups.com><jslint_com%
          > 40yahoogroups.com>
          > > Subject: [jslint] Cascade format
          > >
          > > In "JavaScript: The Good Parts", page 42, a cascade is formatted very
          > > nicely. In my example, I have:
          > >
          > > var htmlToExamine = returnvalue.
          > > replace(/^Success/, "").
          > > replace(/^<div id="\w+_table_\d+_book_buttons".*?<\/div>/, "").
          > > replace(/<script.*?<\/script>/g, "").
          > > replace(/^\s*<[^>]+>\s*/, "").
          > > replace(/\s*<\/\w+>\s*$/, "");
          > >
          > > I like how this looks, lining up the replace method calls. However,
          > JSLint
          > > does not like it. Is there an option I'm missing that lets this format be
          > > accepted?
          >
          > Tzvika Merchav
          >


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