Skip to content

Conversation

calvinmetcalf
Copy link
Contributor

In IE 7(and presumably IE 6) if leaflet.js is in the same directory as the page that is calling it, then the location of the image folder will be resolved as "undefined/images" instead of the full path + "/images" This seems to stem from IE 7 returning the relative urls unchanged instead of converting them to absolute ones like newer browsers.

@@ -44,7 +44,11 @@ L.Icon.Default.imagePath = (function () {
matches = src.match(leafletRe);

if (matches) {
return src.split(leafletRe)[0] + '/images';
if (src.split(leafletRe)[0]) {
return src.split(leafletRe)[0] + '/images';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extract the split result into a variable path (so that there's no repetition) and use the ternary operator:

return (path ? path + '/' : '') + 'images';

@calvinmetcalf
Copy link
Contributor Author

here you go

@mourner
Copy link
Member

mourner commented Jan 18, 2013

Much better isn't it? :) Thanks!

mourner added a commit that referenced this pull request Jan 18, 2013
Wrong default icon path on old IE in certain cases.
@mourner mourner merged commit 4056f4c into Leaflet:master Jan 18, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants