[OpenLayers-Users] specifying options for OL classproperties--when to use quotes?

Mike Quentel mquentel at rim.com
Fri Jul 25 14:14:42 EDT 2008


Thank you everyone for your answers about property keys and quotes.
Seems that the best (ie, for portability and re-use) coding style for
the properties is to use double quotes (because of the possible re-use
in JSON and JS), as long as they are used consistently.  But it's good
to know that, barring JS keywords, quotes are optional for OL properties
use.  Please correct me if I'm wrong in this list summary.

Many thanks.
 
Mike Quentel


-----Original Message-----
From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org]
On Behalf Of Christopher Schmidt
Sent: Thursday, 24 July 2008 20:02
To: Kristian Thy
Cc: users at openlayers.org
Subject: Re: [OpenLayers-Users] specifying options for OL
classproperties--when to use quotes?

On Fri, Jul 25, 2008 at 01:37:37AM +0200, Kristian Thy wrote:
> On Thu, Jul 24, Christopher Schmidt wrote:
> > On Thu, Jul 24, 2008 at 06:07:02PM -0500, Erik Uzureau wrote:
> > > it was explained to me at some point in life that the "proper" 
> > > JSON notation was putting quotes (single?) around the key names, 
> > > ie:
> > 
> > "Double", but I never let that affect my Javascript. 
> 
> Single and double quotes are interchangeable (as long as they match in

> pairs :-) ) in Javascript, just as in (X)HTML.

JSON is not Javascript.

JSON is a subset of Javascript, and single quotes are not allowed.

(As far as I know, all Javascript JSON parsers support single-quoted
keys/values, but most other implementations do not.) 

Regards,
--
Christopher Schmidt
MetaCarta
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users

---------------------------------------------------------------------
This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.



More information about the Users mailing list