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

Re: Require Quoted Keys in Objects

Expand Messages
  • Douglas Crockford
    ... We fixed this in ES5. Once we solve the IE6 problem, it will no longer be necessary to quote reserved words. ... I don t see what this accomplishes. You
    Message 1 of 10 , Mar 10, 2010
    • 0 Attachment
      --- In jslint_com@yahoogroups.com, "davehamptonusa" <david.hampton@...> wrote:
      > Many browsers barf when an object key is a reserved word.

      We fixed this in ES5. Once we solve the IE6 problem, it will no longer be necessary to quote reserved words.

      > As Such, I require my team to quote all object keys.

      I don't see what this accomplishes. You can avoid having to know the reserved word list, but JSLint is already checking this for you.
    • Dave
      Thanks for the reply. Since I quote all mine, I didn t know JSLint was scrubbing for them. I ll peel back my requirement then, as it just adds characters.
      Message 2 of 10 , Mar 10, 2010
      • 0 Attachment
        Thanks for the reply. Since I quote all mine, I didn't know JSLint was scrubbing for them. I'll peel back my requirement then, as it just adds characters.

        Also, curious as to mentioning the ie6 problem... ie7 and ie8 also have issues with reserved words as keys... Maybe you were refering to something else...

        Thanks again...
      • Douglas Crockford
        ... There seem to be two classes of IE users: Those that want to be be using new stuff, and those that want to be using obsolete stuff. Most of the members of
        Message 3 of 10 , Mar 10, 2010
        • 0 Attachment
          --- In jslint_com@yahoogroups.com, "Dave" <david.hampton@...> wrote:
          > Also, curious as to mentioning the ie6 problem... ie7 and ie8 also have issues with reserved words as keys...


          There seem to be two classes of IE users: Those that want to be be using new stuff, and those that want to be using obsolete stuff. Most of the members of the obsolete school are on IE6, and want to stay on it forever.
        • z_mikowski
          If your team uses a build process with a good compressor (e.g. YUI Compressor), it will quote keys as necessary.
          Message 4 of 10 , Mar 10, 2010
          • 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 5 of 10 , Mar 10, 2010
            • 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 6 of 10 , Mar 10, 2010
              • 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 7 of 10 , Mar 17, 2010
                • 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 8 of 10 , Mar 17, 2010
                  • 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.