diff --git a/lib/OpenLayers/BaseTypes.js b/lib/OpenLayers/BaseTypes.js index 1ec0a027ce..e52a94f8e0 100644 --- a/lib/OpenLayers/BaseTypes.js +++ b/lib/OpenLayers/BaseTypes.js @@ -4,13 +4,35 @@ /* OpenLayers.Class metaclass */ OpenLayers.Class = { - create: function() { - return function() { - this.initialize.apply(this, arguments); + isPrototype: function () {}, // magic anonymous value + + create: function() { + return function() { + if (arguments && arguments[0] != OpenLayers.Class.isPrototype) + this.initialize.apply(this, arguments); + } + }, + + inherit: function () { + var super = arguments[0]; + var proto = new super(OpenLayers.Class.isPrototype); + for (var i = 1; i < arguments.length; i++) { + if (typeof arguments[i] == "function") { + var mixin = arguments[i]; + arguments[i] = new mixin(OpenLayers.Class.isPrototype); + } + OpenLayers.Util.extend(proto, arguments[i]); + } + return proto; } - } }; +/* + OpenLayers.Class.inherit( OpenLayers.Layer.Grid, OpenLayers.Layer.HTTPRequest, { + some stuff + }); +*/ + /********************* * * * PIXEL * diff --git a/tests/list-tests.html b/tests/list-tests.html index d44c02a7a3..cf4740722d 100644 --- a/tests/list-tests.html +++ b/tests/list-tests.html @@ -1,4 +1,5 @@