more implicit falsy options to save bytes / memory;

This commit is contained in:
Vladimir Agafonkin 2013-12-05 22:04:22 +02:00
parent 6e0e006209
commit d70d03dbe1
5 changed files with 19 additions and 18 deletions

View File

@ -7,8 +7,8 @@ L.Control.Scale = L.Control.extend({
position: 'bottomleft',
maxWidth: 100,
metric: true,
imperial: true,
updateWhenIdle: false
imperial: true
// updateWhenIdle: false
},
onAdd: function (map) {

View File

@ -22,8 +22,8 @@ L.Popup = L.Layer.extend({
// autoPanPaddingBottomRight: <Point>,
closeButton: true,
keepInView: false,
className: '',
// keepInView: false,
// className: '',
zoomAnimation: true
},
@ -142,7 +142,8 @@ L.Popup = L.Layer.extend({
_initLayout: function () {
var prefix = 'leaflet-popup',
container = this._container = L.DomUtil.create('div',
prefix + ' ' + this.options.className + ' leaflet-zoom-' + (this._animated ? 'animated' : 'hide'));
prefix + ' ' + (this.options.className || '') +
' leaflet-zoom-' + (this._animated ? 'animated' : 'hide'));
if (this.options.closeButton) {
var closeButton = this._closeButton = L.DomUtil.create('a', prefix + '-close-button', container);

View File

@ -3,8 +3,8 @@
*/
L.Icon = L.Class.extend({
/*
options: {
/*
iconUrl: (String) (required)
iconRetinaUrl: (String) (optional, used for retina devices if detected)
iconSize: (Point) (can be set through CSS)
@ -14,9 +14,9 @@ L.Icon = L.Class.extend({
shadowRetinaUrl: (String) (optional, used for retina devices if detected)
shadowSize: (Point)
shadowAnchor: (Point)
*/
className: ''
className: (String)
},
*/
initialize: function (options) {
L.setOptions(this, options);
@ -52,7 +52,7 @@ L.Icon = L.Class.extend({
anchor = L.point(name === 'shadow' && options.shadowAnchor || options.iconAnchor ||
size && size.divideBy(2, true));
img.className = 'leaflet-marker-' + name + ' ' + options.className;
img.className = 'leaflet-marker-' + name + ' ' + (options.className || '');
if (anchor) {
img.style.marginLeft = (-anchor.x) + 'px';

View File

@ -9,7 +9,7 @@ L.TileLayer = L.GridLayer.extend({
maxZoom: 18,
subdomains: 'abc',
errorTileUrl: '',
// errorTileUrl: '',
zoomOffset: 0,
/*

View File

@ -4,12 +4,12 @@
L.Map.include({
_defaultLocateOptions: {
watch: false,
setView: false,
maxZoom: Infinity,
timeout: 10000,
maximumAge: 0,
enableHighAccuracy: false
timeout: 10000
// watch: false
// setView: false
// maxZoom: <Number>
// maximumAge: 0
// enableHighAccuracy: false
},
locate: function (/*Object*/ options) {
@ -77,8 +77,8 @@ L.Map.include({
options = this._locateOptions;
if (options.setView) {
var zoom = Math.min(this.getBoundsZoom(bounds), options.maxZoom);
this.setView(latlng, zoom);
var zoom = this.getBoundsZoom(bounds);
this.setView(latlng, options.maxZoom ? Math.min(zoom, options.maxZoom) : zoom);
}
var data = {