[OSM-dev] OSM home page and IE

Marc Schütz schuetzm at gmx.net
Sun Mar 14 08:27:04 GMT 2010


Am Samstag 13 März 2010 21:48:48 schrieb Mike N.:
> There is a thread in the forums about IE not returning to the most recently
> viewed coordinates when re-opening the OpenStreetMap home page:
> 
> http://forum.openstreetmap.org/viewtopic.php?id=6719
> 
>   I have tracked this down to an error in site.js, line 61:
> 
>   node.addClassName("disabled");
>  (Microsoft JScript runtime error: Object doesn't support this property or
> method)
> 
>  This prevents the rest of the procedure from running that updates the
> cookie with the new location.     However, this is where I've exceeded my
> level of IE DOMness.  Does anyone else recognize what might be wrong and
> how to correct it?

addClassName() is not a DOM function, but an extension by various JS 
frameworks, in particular Prototype, the one used on the OSM site. Prototype 
adds several methods to DOM elements by extending HTMLElement.prototype. This, 
however, is not supported on IE.

See here for details:
http://www.prototypejs.org/learn/extensions

I suggest replacing
	node = document.getElementById("historyanchor");
by
	node = $("historyanchor");
because $() automatically extends the element. Likewise for all other calls to 
document.getElementById().

Regards, Marc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20100314/6622d59b/attachment.pgp>


More information about the dev mailing list