One more observation:
This lib used a unique (and clever) technique to track overlays been
added to the map instance. It overwrites the Class.prototype.setMap
method by creating an alias pointer to the original function and call
it afterward using the alias. There is a potential risk introduced by
the closure compiler. There are other forum posters pointed this out
the closure forum before, so I just repeat here using this example:
The compiler renamed "setMapOriginal_" in the compile process, in the
actual result, it became google[B][a][E].q=google[B][a][E].setMap;
Now, there is no guarantee that it will always be renamed to "q"
because the compiler make decision based on the code. Hypothetically,
it can be renamed to something like "l".
Here is the problem: if the core API class has already have something
called "q" or "l", it will break. Since the core API is compiled
independently from this lib, future release can break it. I was able
create a sample just demo that.
I renamed the "q" method to "l" in the compiled code (again, it
entirely possible for the compiler to produce it but I did it for demo
purpose). Now check this link:
http://gmaps-utility-gis.googlecode.com/svn/trunk/v3test/earthv3/earth_compiled.html?v=3.2
This link loads API 3.2. Now click through the top link to load
different version of core API, you will see 3.3 works fine, but, the
KML layer (Chicago transit) broke in 3.4. It's because there is an new
"l" function in the KMLLayerOverlay class introduced in 3.4 that
clashed with the earth lib code.
So, I think setMapOriginal_ method probably should be protected using
quote so the compiler would leave it along, assuming the core API will
never have something called setMapOriginal_.
On Mar 25, 3:38 pm, Nianwei Liu <
nian...@gmail.com> wrote:
> Josh,