[OpenLayers-Commits] r12215 - in trunk/openlayers:
lib/OpenLayers/BaseTypes tests/BaseTypes
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Mon Aug 8 08:43:48 EDT 2011
Author: erilem
Date: 2011-08-08 05:43:47 -0700 (Mon, 08 Aug 2011)
New Revision: 12215
Modified:
trunk/openlayers/lib/OpenLayers/BaseTypes/Class.js
trunk/openlayers/tests/BaseTypes/Class.html
Log:
make constructors created by OpenLayers.Class call the parent's initialize method rather the parent constructor, this is to accomodate usage patterns of IGN's GeoPortal API, r=ahocevar (closes #3454)
Modified: trunk/openlayers/lib/OpenLayers/BaseTypes/Class.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/BaseTypes/Class.js 2011-08-08 12:39:39 UTC (rev 12214)
+++ trunk/openlayers/lib/OpenLayers/BaseTypes/Class.js 2011-08-08 12:43:47 UTC (rev 12215)
@@ -37,7 +37,7 @@
var C = typeof F.initialize == "function" ?
F.initialize :
- function(){ P.apply(this, arguments); };
+ function(){ P.prototype.initialize.apply(this, arguments); };
if (len > 1) {
var newArgs = [C, P].concat(
Modified: trunk/openlayers/tests/BaseTypes/Class.html
===================================================================
--- trunk/openlayers/tests/BaseTypes/Class.html 2011-08-08 12:39:39 UTC (rev 12214)
+++ trunk/openlayers/tests/BaseTypes/Class.html 2011-08-08 12:43:47 UTC (rev 12215)
@@ -432,27 +432,26 @@
t.eq(b.a, "bar", "ctor overwritten");
}
- // This test doesn't currently pass.
- /*
function test_overwrite_5(t) {
// overwrite constructor of parent class, which itself
// doesn't defined "initialize"
- t.plan(1);
+ t.plan(2);
var A = OpenLayers.Class({
initialize: function() {
this.a = "foo";
}
});
var B = OpenLayers.Class(A, {});
+ var _A = A;
A = overwrite(A, {
initialize: function() {
this.a = "bar";
}
});
var b = new B;
+ t.ok(A.prototype === _A.prototype, "A and _A share the prototype");
t.eq(b.a, "bar", "ctor overwritten");
}
- */
function test_overwrite_6(t) {
// with static methods
More information about the Commits
mailing list