Closed GoogleCodeExporter closed 8 years ago
If you use it offline you could just add
if ( google.maps ) {
// the plugin code here
}
About "initialize the plugin manually" - I need more explanation.
Original comment by johansalllarsson
on 24 May 2011 at 5:20
I meant that the code in jquery.ui.map.js that extends $.fn and creates the
ui.gmap object should only be executed when the client code calls some init()
method, rather than being wrapped in a self-executing function. Otherwise it
can throw a reference error on startup because google and google.maps are
undefined, and can break unrelated click, rightclick, dblclick, etc. event
handlers in the application because of the reference to google.maps.MVCObject
in addEventListener.
I understand that a user of the library can modify the source file as needed to
put in the needed checks, but ideally, library code should not easily break
unrelated functionality. Deferring the plugin initialization to a manually
called method would allow client applications to avoid these problems.
Original comment by kpozin@gmail.com
on 24 May 2011 at 5:46
[deleted comment]
You are correct that the plugin shouldn't break any jquery core events if you
are missing the google maps source. Thanks for pointing this out :). I've fixed
that in the trunk. With this fix there is no need for any init method.
Original comment by johansalllarsson
on 25 May 2011 at 3:28
Original issue reported on code.google.com by
kpozin@gmail.com
on 24 May 2011 at 3:23