Code coverage report for src/layer/marker/Icon.Default.js

Statements: 73.68% (14 / 19)      Branches: 41.67% (5 / 12)      Functions: 100% (2 / 2)      Lines: 73.68% (14 / 19)     

All files » src/layer/marker/ » Icon.Default.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52        1                     4   4       4       4   4       4       1 1     1   1 34 34   34            
/*
 * L.Icon.Default is the blue marker icon used by default in Leaflet.
 */
 
L.Icon.Default = L.Icon.extend({
 
	options: {
		iconSize: new L.Point(25, 41),
		iconAnchor: new L.Point(12, 41),
		popupAnchor: new L.Point(1, -34),
 
		shadowSize: new L.Point(41, 41)
	},
 
	_getIconUrl: function (name) {
		var key = name + 'Url';
 
		Iif (this.options[key]) {
			return this.options[key];
		}
 
		Iif (L.Browser.retina && name === 'icon') {
			name += '@2x';
		}
 
		var path = L.Icon.Default.imagePath;
 
		Iif (!path) {
			throw new Error("Couldn't autodetect L.Icon.Default.imagePath, set it manually.");
		}
 
		return path + '/marker-' + name + '.png';
	}
});
 
L.Icon.Default.imagePath = (function () {
	var scripts = document.getElementsByTagName('script'),
	    leafletRe = /\/?leaflet[\-\._]?([\w\-\._]*)\.js\??/;
 
	var i, len, src, matches, path;
 
	for (i = 0, len = scripts.length; i < len; i++) {
		src = scripts[i].src;
		matches = src.match(leafletRe);
 
		Iif (matches) {
			path = src.split(leafletRe)[0];
			return (path ? path + '/' : '') + 'images';
		}
	}
}());