[OpenLayers-Dev] 2.10 and 2.11-RC1 OpenLayers.Class behavior changes

RICHARD Didier didier.richard at ign.fr
Mon Aug 1 17:30:26 EDT 2011


> On Sun, Jul 24, 2011 at 11:38 PM, Andreas Hocevar <ahocevar at opengeo.org>
> wrote:
>> Hi Didier,
>>
>> not sure if you've seen my follow-up mail. You need to re-assign the
>> protoype after the snippet I posted. So the whole snippet would be:
>>
>> var X= OpenLayers.Class({
>>   initialize:function() { this._p= "A.initialize";
>> OpenLayers.Console.info(this._p); },
>>   pa:"PA",
>>   p_:null,
>>   ma:function() { OpenLayers.Console.info("A.ma="+this.pa); }
>> });
>> xProto = X.prototype;
>> xProto.initialize = function() { this.p_= "A.initialize-new";
>> OpenLayers.Console.info(this.p_); }
>> X = xProto.initialize;
>> X.proto = xProto;
>
> Is setting xProto.initialize mandatory? How about this little
> simplification:
>
> var proto = X.prototype;
> X = function() { /* new ctor */ };
> X.prototype = proto;
>
> ?

I will give it a try ...

>
> I guess the same simplification should apply to Andreas' OverloadB
> snippet.
>
> Cheers,
>
> PS: BTW, I agree there's no regression here :-)
>

Really not sure : I am still stuck with constructor modifications (when
sub-classes use the same constructor as the superclass whose initialize
method is beeing modified) in the class hierarchy in OL 2.11 rc1. I had no
problem with OL 2.10 ...

If core developpers think there is no regression, a real documentation
should be provided to developpers as a proof of it. Maybe in the test
directory ?

Regards,

didier

>
> --
> Eric Lemoine
>
> Camptocamp France SAS
> Savoie Technolac, BP 352
> 73377 Le Bourget du Lac, Cedex
>
> Tel : 00 33 4 79 44 44 96
> Mail : eric.lemoine at camptocamp.com
> http://www.camptocamp.com
>


-- 
RICHARD Didier - Chef du pôle technique du Géoportail
2/4, avenue Pasteur - 94165 Saint Mandé Cedex
Tél : +33 (0) 1 43 98 83 23


More information about the Dev mailing list