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

Re: Require Quoted Keys in Objects

Expand Messages
  • z_mikowski
    If your team uses a build process with a good compressor (e.g. YUI Compressor), it will quote keys as necessary.
    Message 1 of 10 , Mar 10 6:16 PM
    • 0 Attachment
      If your team uses a build process with a good compressor (e.g. YUI Compressor), it will quote keys as necessary.

      --- In jslint_com@yahoogroups.com, "davehamptonusa" <david.hampton@...> wrote:
      >
      > Many browsers barf when an object key is a reserved word. Sure, they
      > should be able to figure out that we are in an object.... But IE
      > can't.Example:
      > var foop = { class: 'barley', style: 'ale'}; //Barfs in ie...
      > var foop = { 'class': 'barley', 'style': 'ale'}; //Happy in all
      > environements
      > As Such, I require my team to quote all object keys. As much as I think
      > this should be a Good Parts requirement, I'll settle for a toggle in
      > JSLint...
      > Any thoughts?
      >
      >
      > [Non-text portions of this message have been removed]
      >
    • Michael Lorton
      Eek. A compressor that changes the semantics of the file it s compressing? Admittedly, it s harmless in this case (it s changing it from doesn t work in
      Message 2 of 10 , Mar 10 8:20 PM
      • 0 Attachment
        Eek. A compressor that changes the semantics of the file it's compressing? Admittedly, it's harmless in this case (it's changing it from "doesn't work in IE6" to "does work") but still, slippery slope and all that.

        M.




        ________________________________
        From: z_mikowski <z_mikowski@...>
        To: jslint_com@yahoogroups.com
        Sent: Wed, March 10, 2010 6:16:43 PM
        Subject: [jslint] Re: Require Quoted Keys in Objects

        If your team uses a build process with a good compressor (e.g. YUI Compressor), it will quote keys as necessary.

        --- In jslint_com@yahoogroups.com, "davehamptonusa" <david.hampton@...> wrote:
        >
        > Many browsers barf when an object key is a reserved word. Sure, they
        > should be able to figure out that we are in an object.... But IE
        > can't.Example:
        > var foop = { class: 'barley', style: 'ale'}; //Barfs in ie...
        > var foop = { 'class': 'barley', 'style': 'ale'}; //Happy in all
        > environements
        > As Such, I require my team to quote all object keys. As much as I think
        > this should be a Good Parts requirement, I'll settle for a toggle in
        > JSLint...
        > Any thoughts?
        >
        >
        > [Non-text portions of this message have been removed]
        >




        ------------------------------------

        Yahoo! Groups Links



        [Non-text portions of this message have been removed]
      • Michael Mikowski
        I stand corrected; YUI compressor 2.4.2 actually throws an exception when using an unquoted reserved word as a key. We never see this because our builds
        Message 3 of 10 , Mar 10 9:52 PM
        • 0 Attachment
          I stand corrected; YUI compressor 2.4.2 actually throws an exception when using an unquoted reserved word as a key.

          We never see this because our builds obfuscate keys before YUI Compressor is run.

          In any case, jslint and YUI compressor both catch the problem.

          Cheers, Mike



          ________________________________
          From: Michael Lorton <mlorton@...>
          To: jslint_com@yahoogroups.com
          Sent: Wed, March 10, 2010 8:20:20 PM
          Subject: Re: [jslint] Re: Require Quoted Keys in Objects


          Eek. A compressor that changes the semantics of the file it's compressing? Admittedly, it's harmless in this case (it's changing it from "doesn't work in IE6" to "does work") but still, slippery slope and all that.

          M.

          ____________ _________ _________ __
          From: z_mikowski <z_mikowski@yahoo. com>
          To: jslint_com@yahoogro ups.com
          Sent: Wed, March 10, 2010 6:16:43 PM
          Subject: [jslint] Re: Require Quoted Keys in Objects

          If your team uses a build process with a good compressor (e.g. YUI Compressor), it will quote keys as necessary.

          --- In jslint_com@yahoogro ups.com, "davehamptonusa" <david.hampton@ ...> wrote:
          >
          > Many browsers barf when an object key is a reserved word. Sure, they
          > should be able to figure out that we are in an object.... But IE
          > can't.Example:
          > var foop = { class: 'barley', style: 'ale'}; //Barfs in ie...
          > var foop = { 'class': 'barley', 'style': 'ale'}; //Happy in all
          > environements
          > As Such, I require my team to quote all object keys. As much as I think
          > this should be a Good Parts requirement, I'll settle for a toggle in
          > JSLint...
          > Any thoughts?
          >
          >
          > [Non-text portions of this message have been removed]
          >

          ------------ --------- --------- ------

          Yahoo! Groups Links

          [Non-text portions of this message have been removed]




          [Non-text portions of this message have been removed]
        • Dave
          Clearly, JSlint is for uncompressed, unobfuscated code. It s meant to catch things in a development environment. To suggest using a compressor as a tool for
          Message 4 of 10 , Mar 17 3:24 PM
          • 0 Attachment
            Clearly, JSlint is for uncompressed, unobfuscated code.

            It's meant to catch things in a development environment. To suggest using a compressor as a tool for validating good code is a bit silly.

            Certainly, you couldn't effectively debug and optimise code in a dev environment if it was already compressed and obfuscated.



            --- In jslint_com@yahoogroups.com, "z_mikowski" <z_mikowski@...> wrote:
            >
            > If your team uses a build process with a good compressor (e.g. YUI Compressor), it will quote keys as necessary.
            >
            > --- In jslint_com@yahoogroups.com, "davehamptonusa" <david.hampton@> wrote:
            > >
            > > Many browsers barf when an object key is a reserved word. Sure, they
            > > should be able to figure out that we are in an object.... But IE
            > > can't.Example:
            > > var foop = { class: 'barley', style: 'ale'}; //Barfs in ie...
            > > var foop = { 'class': 'barley', 'style': 'ale'}; //Happy in all
            > > environements
            > > As Such, I require my team to quote all object keys. As much as I think
            > > this should be a Good Parts requirement, I'll settle for a toggle in
            > > JSLint...
            > > Any thoughts?
            > >
            > >
            > > [Non-text portions of this message have been removed]
            > >
            >
          • Michael Mikowski
            I gave you a data point, not a suggestion for workflow. Use it as you wish. Oh, and you re welcome. ________________________________ From: Dave
            Message 5 of 10 , Mar 17 5:44 PM
            • 0 Attachment
              I gave you a data point, not a suggestion for workflow. Use it as you wish. Oh, and you're welcome.



              ________________________________
              From: Dave <david.hampton@...>
              To: jslint_com@yahoogroups.com
              Sent: Wed, March 17, 2010 3:24:17 PM
              Subject: [jslint] Re: Require Quoted Keys in Objects


              Clearly, JSlint is for uncompressed, unobfuscated code.

              It's meant to catch things in a development environment. To suggest using a compressor as a tool for validating good code is a bit silly.

              Certainly, you couldn't effectively debug and optimise code in a dev environment if it was already compressed and obfuscated.

              --- In jslint_com@yahoogro ups.com, "z_mikowski" <z_mikowski@ ...> wrote:
              >
              > If your team uses a build process with a good compressor (e.g. YUI Compressor), it will quote keys as necessary.
              >
              > --- In jslint_com@yahoogro ups.com, "davehamptonusa" <david.hampton@ > wrote:
              > >
              > > Many browsers barf when an object key is a reserved word. Sure, they
              > > should be able to figure out that we are in an object.... But IE
              > > can't.Example:
              > > var foop = { class: 'barley', style: 'ale'}; //Barfs in ie...
              > > var foop = { 'class': 'barley', 'style': 'ale'}; //Happy in all
              > > environements
              > > As Such, I require my team to quote all object keys. As much as I think
              > > this should be a Good Parts requirement, I'll settle for a toggle in
              > > JSLint...
              > > Any thoughts?
              > >
              > >
              > > [Non-text portions of this message have been removed]
              > >
              >




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