jamespadolsey/jsapi-info — Issue #3: Resolving of extension classes causes bad source links
Author: drewwells
Created: 2011-11-08 15:36:06+00:00
State: open

This one will be hard to reproduce. OpenLayers has definitions that look like this:

OpenLayers.Layer.OSM = OpenLayers.Class(OpenLayers.Layer.XYZ, {
name: "OpenStreetMap",
attribution: "Data CC-By-SA by OpenStreetMap",
sphericalMercator: true,
url: 'http://tile.openstreetmap.org/${z}/${x}/${y}.png',
...
}

When you view OpenLayers.Layer.OSM, you get this:

function(){ P.apply(this, arguments); };

The definition of `OpenLayers.Class` looks like so:

OpenLayers.Class = function() {
var len = arguments.length;
var P = arguments[0];
var F = arguments[len-1];

var C = typeof F.initialize == "function" ?
F.initialize :
function(){ P.prototype.initialize.apply(this, arguments); };

if (len > 1) {
var newArgs = [C, P].concat(
Array.prototype.slice.call(arguments).slice(1, len-1), F);
OpenLayers.inherit.apply(null, newArgs);
} else {
C.prototype = F;
}
return C;
};

It seems OSM is being resolved to via OpenLayers.Class and pointing to the closure they used to extend the object. Any ideas on how to un-foobar this?