add window and undefined to outer closure

This commit is contained in:
mourner 2012-07-01 16:18:00 +03:00
parent 86363c1d54
commit 50c6c480b4
8 changed files with 23 additions and 23 deletions

View File

@ -51,11 +51,11 @@ exports.uglify = function (code) {
}; };
exports.combineFiles = function (files) { exports.combineFiles = function (files) {
var content = '(function () {\n\n'; var content = '(function (window, undefined) {\n\n';
for (var i = 0, len = files.length; i < len; i++) { for (var i = 0, len = files.length; i < len; i++) {
content += fs.readFileSync(files[i], 'utf8') + '\n\n'; content += fs.readFileSync(files[i], 'utf8') + '\n\n';
} }
return content + '\n\n}());'; return content + '\n\n}(this));';
}; };
exports.save = function (savePath, compressed) { exports.save = function (savePath, compressed) {

22
dist/leaflet-src.js vendored
View File

@ -3,11 +3,11 @@
Leaflet is a modern open-source JavaScript library for interactive maps. Leaflet is a modern open-source JavaScript library for interactive maps.
http://leaflet.cloudmade.com http://leaflet.cloudmade.com
*/ */
(function () { (function (window, undefined) {
var L, originalL; var L, originalL;
if (typeof exports !== 'undefined') { if (typeof exports !== undefined + '') {
L = exports; L = exports;
} else { } else {
originalL = window.L; originalL = window.L;
@ -338,7 +338,7 @@ L.Mixin.Events.fire = L.Mixin.Events.fireEvent;
gecko = ua.indexOf("gecko") !== -1, gecko = ua.indexOf("gecko") !== -1,
opera = window.opera, opera = window.opera,
android = ua.indexOf("android") !== -1, android = ua.indexOf("android") !== -1,
mobile = typeof orientation !== 'undefined' ? true : false, mobile = typeof orientation !== undefined + '' ? true : false,
doc = document.documentElement, doc = document.documentElement,
ie3d = ie && ('transition' in doc.style), ie3d = ie && ('transition' in doc.style),
webkit3d = webkit && ('WebKitCSSMatrix' in window) && ('m11' in new window.WebKitCSSMatrix()), webkit3d = webkit && ('WebKitCSSMatrix' in window) && ('m11' in new window.WebKitCSSMatrix()),
@ -1049,7 +1049,7 @@ L.Map = L.Class.extend({
this.setMaxBounds(options.maxBounds); this.setMaxBounds(options.maxBounds);
} }
if (options.center && typeof options.zoom !== 'undefined') { if (options.center && options.zoom !== undefined) {
this.setView(options.center, options.zoom, true); this.setView(options.center, options.zoom, true);
} }
@ -1276,8 +1276,8 @@ L.Map = L.Class.extend({
}, },
getMaxZoom: function () { getMaxZoom: function () {
var z1 = typeof this.options.maxZoom === 'undefined' ? Infinity : this.options.maxZoom, var z1 = this.options.maxZoom === undefined ? Infinity : this.options.maxZoom,
z2 = typeof this._layersMaxZoom === 'undefined' ? Infinity : this._layersMaxZoom; z2 = this._layersMaxZoom === undefined ? Infinity : this._layersMaxZoom;
return Math.min(z1, z2); return Math.min(z1, z2);
}, },
@ -1361,12 +1361,12 @@ L.Map = L.Class.extend({
// conversion methods // conversion methods
project: function (latlng, zoom) { // (LatLng[, Number]) -> Point project: function (latlng, zoom) { // (LatLng[, Number]) -> Point
zoom = typeof zoom === 'undefined' ? this._zoom : zoom; zoom = zoom === undefined ? this._zoom : zoom;
return this.options.crs.latLngToPoint(latlng, zoom); return this.options.crs.latLngToPoint(latlng, zoom);
}, },
unproject: function (point, zoom) { // (Point[, Number]) -> LatLng unproject: function (point, zoom) { // (Point[, Number]) -> LatLng
zoom = typeof zoom === 'undefined' ? this._zoom : zoom; zoom = zoom === undefined ? this._zoom : zoom;
return this.options.crs.pointToLatLng(point, zoom); return this.options.crs.pointToLatLng(point, zoom);
}, },
@ -3756,7 +3756,7 @@ L.LineUtil = {
_simplifyDP: function (points, sqTolerance) { _simplifyDP: function (points, sqTolerance) {
var len = points.length, var len = points.length,
ArrayConstructor = typeof Uint8Array !== 'undefined' ? Uint8Array : Array, ArrayConstructor = typeof Uint8Array !== undefined + '' ? Uint8Array : Array,
markers = new ArrayConstructor(len); markers = new ArrayConstructor(len);
markers[0] = markers[len - 1] = 1; markers[0] = markers[len - 1] = 1;
@ -5080,7 +5080,7 @@ L.Map.Drag = L.Handler.extend({
noInertia = !options.inertia || noInertia = !options.inertia ||
delay > options.inertiaThreshold || delay > options.inertiaThreshold ||
typeof this._positions[0] === 'undefined'; this._positions[0] === undefined;
if (noInertia) { if (noInertia) {
map.fire('moveend'); map.fire('moveend');
@ -6856,4 +6856,4 @@ L.Map.include({
}()); }(this));

2
dist/leaflet.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
var L, originalL; var L, originalL;
if (typeof exports !== 'undefined') { if (typeof exports !== undefined + '') {
L = exports; L = exports;
} else { } else {
originalL = window.L; originalL = window.L;

View File

@ -6,7 +6,7 @@
gecko = ua.indexOf("gecko") !== -1, gecko = ua.indexOf("gecko") !== -1,
opera = window.opera, opera = window.opera,
android = ua.indexOf("android") !== -1, android = ua.indexOf("android") !== -1,
mobile = typeof orientation !== 'undefined' ? true : false, mobile = typeof orientation !== undefined + '' ? true : false,
doc = document.documentElement, doc = document.documentElement,
ie3d = ie && ('transition' in doc.style), ie3d = ie && ('transition' in doc.style),
webkit3d = webkit && ('WebKitCSSMatrix' in window) && ('m11' in new window.WebKitCSSMatrix()), webkit3d = webkit && ('WebKitCSSMatrix' in window) && ('m11' in new window.WebKitCSSMatrix()),

View File

@ -37,7 +37,7 @@ L.LineUtil = {
_simplifyDP: function (points, sqTolerance) { _simplifyDP: function (points, sqTolerance) {
var len = points.length, var len = points.length,
ArrayConstructor = typeof Uint8Array !== 'undefined' ? Uint8Array : Array, ArrayConstructor = typeof Uint8Array !== undefined + '' ? Uint8Array : Array,
markers = new ArrayConstructor(len); markers = new ArrayConstructor(len);
markers[0] = markers[len - 1] = 1; markers[0] = markers[len - 1] = 1;

View File

@ -32,7 +32,7 @@ L.Map = L.Class.extend({
this.setMaxBounds(options.maxBounds); this.setMaxBounds(options.maxBounds);
} }
if (options.center && typeof options.zoom !== 'undefined') { if (options.center && options.zoom !== undefined) {
this.setView(options.center, options.zoom, true); this.setView(options.center, options.zoom, true);
} }
@ -259,8 +259,8 @@ L.Map = L.Class.extend({
}, },
getMaxZoom: function () { getMaxZoom: function () {
var z1 = typeof this.options.maxZoom === 'undefined' ? Infinity : this.options.maxZoom, var z1 = this.options.maxZoom === undefined ? Infinity : this.options.maxZoom,
z2 = typeof this._layersMaxZoom === 'undefined' ? Infinity : this._layersMaxZoom; z2 = this._layersMaxZoom === undefined ? Infinity : this._layersMaxZoom;
return Math.min(z1, z2); return Math.min(z1, z2);
}, },
@ -344,12 +344,12 @@ L.Map = L.Class.extend({
// conversion methods // conversion methods
project: function (latlng, zoom) { // (LatLng[, Number]) -> Point project: function (latlng, zoom) { // (LatLng[, Number]) -> Point
zoom = typeof zoom === 'undefined' ? this._zoom : zoom; zoom = zoom === undefined ? this._zoom : zoom;
return this.options.crs.latLngToPoint(latlng, zoom); return this.options.crs.latLngToPoint(latlng, zoom);
}, },
unproject: function (point, zoom) { // (Point[, Number]) -> LatLng unproject: function (point, zoom) { // (Point[, Number]) -> LatLng
zoom = typeof zoom === 'undefined' ? this._zoom : zoom; zoom = zoom === undefined ? this._zoom : zoom;
return this.options.crs.pointToLatLng(point, zoom); return this.options.crs.pointToLatLng(point, zoom);
}, },

View File

@ -108,7 +108,7 @@ L.Map.Drag = L.Handler.extend({
noInertia = !options.inertia || noInertia = !options.inertia ||
delay > options.inertiaThreshold || delay > options.inertiaThreshold ||
typeof this._positions[0] === 'undefined'; this._positions[0] === undefined;
if (noInertia) { if (noInertia) {
map.fire('moveend'); map.fire('moveend');