Inline !goog.isDef() property checks

This commit is contained in:
Tim Schaub
2015-09-27 10:24:38 -06:00
parent 6638ae855d
commit 3a0683f373
8 changed files with 9 additions and 9 deletions

View File

@@ -114,7 +114,7 @@ ol.Image.prototype.handleImageError_ = function() {
* @private
*/
ol.Image.prototype.handleImageLoad_ = function() {
if (!goog.isDef(this.resolution)) {
if (this.resolution === undefined) {
this.resolution = ol.extent.getHeight(this.extent) / this.image_.height;
}
this.state = ol.ImageState.LOADED;

View File

@@ -152,7 +152,7 @@ ol.proj.Projection = function(options) {
if (goog.isDef(def.axis) && !goog.isDef(options.axisOrientation)) {
this.axisOrientation_ = def.axis;
}
if (!goog.isDef(options.units)) {
if (options.units === undefined) {
var units = def.units;
if (units === undefined) {
if (def.to_meter !== undefined) {

View File

@@ -103,7 +103,7 @@ ol.source.Cluster.prototype.onSourceChange_ = function() {
* @private
*/
ol.source.Cluster.prototype.cluster_ = function() {
if (!goog.isDef(this.resolution_)) {
if (this.resolution_ === undefined) {
return;
}
this.features_.length = 0;

View File

@@ -142,7 +142,7 @@ ol.source.ImageWMS.prototype.getGetFeatureInfoUrl =
goog.asserts.assert(!('VERSION' in params),
'key VERSION is not allowed in params');
if (!goog.isDef(this.url_)) {
if (this.url_ === undefined) {
return undefined;
}
@@ -188,7 +188,7 @@ ol.source.ImageWMS.prototype.getParams = function() {
ol.source.ImageWMS.prototype.getImage =
function(extent, resolution, pixelRatio, projection) {
if (!goog.isDef(this.url_)) {
if (this.url_ === undefined) {
return null;
}

View File

@@ -58,7 +58,7 @@ ol.style.Fill.prototype.setColor = function(color) {
* @inheritDoc
*/
ol.style.Fill.prototype.getChecksum = function() {
if (!goog.isDef(this.checksum_)) {
if (this.checksum_ === undefined) {
this.checksum_ = 'f' + (!goog.isNull(this.color_) ?
ol.color.asString(this.color_) : '-');
}

View File

@@ -203,7 +203,7 @@ ol.style.Stroke.prototype.setWidth = function(width) {
* @inheritDoc
*/
ol.style.Stroke.prototype.getChecksum = function() {
if (!goog.isDef(this.checksum_)) {
if (this.checksum_ === undefined) {
var raw = 's' +
(!goog.isNull(this.color_) ?
ol.color.asString(this.color_) : '-') + ',' +

View File

@@ -552,7 +552,7 @@ ol.tilegrid.createXYZ = function(opt_options) {
var options = /** @type {olx.tilegrid.TileGridOptions} */ ({});
goog.object.extend(options, goog.isDef(opt_options) ?
opt_options : /** @type {olx.tilegrid.XYZOptions} */ ({}));
if (!goog.isDef(options.extent)) {
if (options.extent === undefined) {
options.extent = ol.proj.get('EPSG:3857').getExtent();
}
options.resolutions = ol.tilegrid.resolutionsFromExtent(

View File

@@ -837,7 +837,7 @@ describe('ol.extent', function() {
it('takes arbitrary function', function() {
var transformFn = function(input, output, opt_dimension) {
var dimension = goog.isDef(opt_dimension) ? opt_dimension : 2;
if (!goog.isDef(output)) {
if (output === undefined) {
output = new Array(input.length);
}
var n = input.length;