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

Eric Lemoine eric.c2c at gmail.com
Wed Jul 23 13:00:50 EDT 2008


Likewise you cannot do myobject.<key> if key is a reserved js word,
you'll do myobject['<key>'] instead. Example: myobject['delete']

Cheers. eric

2008/7/23, Christopher Schmidt <crschmidt at metacarta.com>:
> On Wed, Jul 23, 2008 at 12:42:35PM -0400, Mike Quentel wrote:
>> In some of the examples, when adding a Layer, I see some properties
>> (options) have quotes (single or double).  What is the general rule for
>> using quotes on the properties?
>>
>> Is this correct:
>>
>> {buffer: 2, gutter: 15, sphericalMercator: true, attribution: "some
>> label"}
>>
>> or should it be this:
>>
>> {'buffer': 2, 'gutter': 15, 'sphericalMercator': true, 'attribution':
>> "some label"}
>
> It makes no difference, except in a case here one of your 'keys' is a
> javascript reserved word (like 'class' or 'function').
>
> Regards,
> --
> Christopher Schmidt
> MetaCarta
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



More information about the Users mailing list