Inline simple goog.isDef() checks
This commit is contained in:
@@ -15,7 +15,7 @@ goog.require('goog.asserts');
|
||||
ol.geom.flat.flip.flipXY =
|
||||
function(flatCoordinates, offset, end, stride, opt_dest, opt_destOffset) {
|
||||
var dest, destOffset;
|
||||
if (goog.isDef(opt_dest)) {
|
||||
if (opt_dest !== undefined) {
|
||||
dest = opt_dest;
|
||||
destOffset = goog.isDef(opt_destOffset) ? opt_destOffset : 0;
|
||||
} else {
|
||||
|
||||
@@ -78,7 +78,7 @@ goog.inherits(ol.Image, ol.ImageBase);
|
||||
* @api
|
||||
*/
|
||||
ol.Image.prototype.getImage = function(opt_context) {
|
||||
if (goog.isDef(opt_context)) {
|
||||
if (opt_context !== undefined) {
|
||||
var image;
|
||||
var key = goog.getUid(opt_context);
|
||||
if (key in this.imageByContext_) {
|
||||
|
||||
@@ -81,7 +81,7 @@ ol.ImageTile.prototype.disposeInternal = function() {
|
||||
* @api
|
||||
*/
|
||||
ol.ImageTile.prototype.getImage = function(opt_context) {
|
||||
if (goog.isDef(opt_context)) {
|
||||
if (opt_context !== undefined) {
|
||||
var image;
|
||||
var key = goog.getUid(opt_context);
|
||||
if (key in this.imageByContext_) {
|
||||
|
||||
@@ -116,7 +116,7 @@ ol.Object = function(opt_values) {
|
||||
*/
|
||||
this.values_ = {};
|
||||
|
||||
if (goog.isDef(opt_values)) {
|
||||
if (opt_values !== undefined) {
|
||||
this.setProperties(opt_values);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -148,7 +148,7 @@ ol.proj.Projection = function(options) {
|
||||
if (ol.ENABLE_PROJ4JS && typeof proj4 == 'function' &&
|
||||
!goog.isDef(projections[code])) {
|
||||
var def = proj4.defs(code);
|
||||
if (goog.isDef(def)) {
|
||||
if (def !== undefined) {
|
||||
if (goog.isDef(def.axis) && !goog.isDef(options.axisOrientation)) {
|
||||
this.axisOrientation_ = def.axis;
|
||||
}
|
||||
@@ -165,7 +165,7 @@ ol.proj.Projection = function(options) {
|
||||
var currentCode, currentDef, currentProj, proj4Transform;
|
||||
for (currentCode in projections) {
|
||||
currentDef = proj4.defs(currentCode);
|
||||
if (goog.isDef(currentDef)) {
|
||||
if (currentDef !== undefined) {
|
||||
currentProj = ol.proj.get(currentCode);
|
||||
if (currentDef === def) {
|
||||
ol.proj.addEquivalentProjections([currentProj, this]);
|
||||
@@ -361,7 +361,7 @@ ol.proj.Projection.prototype.getPointResolution_ = function(resolution, point) {
|
||||
vertices.slice(4, 6), vertices.slice(6, 8));
|
||||
var pointResolution = (width + height) / 2;
|
||||
var metersPerUnit = this.getMetersPerUnit();
|
||||
if (goog.isDef(metersPerUnit)) {
|
||||
if (metersPerUnit !== undefined) {
|
||||
pointResolution /= metersPerUnit;
|
||||
}
|
||||
return pointResolution;
|
||||
@@ -761,7 +761,7 @@ ol.proj.identityTransform = function(input, opt_output, opt_dimension) {
|
||||
*/
|
||||
ol.proj.cloneTransform = function(input, opt_output, opt_dimension) {
|
||||
var output;
|
||||
if (goog.isDef(opt_output)) {
|
||||
if (opt_output !== undefined) {
|
||||
for (var i = 0, ii = input.length; i < ii; ++i) {
|
||||
opt_output[i] = input[i];
|
||||
}
|
||||
|
||||
@@ -417,7 +417,7 @@ ol.render.canvas.Immediate.prototype.drawRings_ =
|
||||
ol.render.canvas.Immediate.prototype.drawAsync = function(zIndex, callback) {
|
||||
var zIndexKey = zIndex.toString();
|
||||
var callbacks = this.callbacksByZIndex_[zIndexKey];
|
||||
if (goog.isDef(callbacks)) {
|
||||
if (callbacks !== undefined) {
|
||||
callbacks.push(callback);
|
||||
} else {
|
||||
this.callbacksByZIndex_[zIndexKey] = [callback];
|
||||
|
||||
@@ -406,7 +406,7 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
||||
++i;
|
||||
break;
|
||||
case ol.render.canvas.Instruction.END_GEOMETRY:
|
||||
if (goog.isDef(featureCallback)) {
|
||||
if (featureCallback !== undefined) {
|
||||
feature = /** @type {ol.Feature} */ (instruction[1]);
|
||||
var result = featureCallback(feature);
|
||||
if (result) {
|
||||
@@ -1220,7 +1220,7 @@ ol.render.canvas.PolygonReplay.prototype.drawCircleGeometry =
|
||||
if (!goog.isDef(fillStyle) && !goog.isDef(strokeStyle)) {
|
||||
return;
|
||||
}
|
||||
if (goog.isDef(strokeStyle)) {
|
||||
if (strokeStyle !== undefined) {
|
||||
goog.asserts.assert(goog.isDef(state.lineWidth),
|
||||
'state.lineWidth should be defined');
|
||||
}
|
||||
@@ -1273,7 +1273,7 @@ ol.render.canvas.PolygonReplay.prototype.drawPolygonGeometry =
|
||||
if (!goog.isDef(fillStyle) && !goog.isDef(strokeStyle)) {
|
||||
return;
|
||||
}
|
||||
if (goog.isDef(strokeStyle)) {
|
||||
if (strokeStyle !== undefined) {
|
||||
goog.asserts.assert(goog.isDef(state.lineWidth),
|
||||
'state.lineWidth should be defined');
|
||||
}
|
||||
@@ -1309,7 +1309,7 @@ ol.render.canvas.PolygonReplay.prototype.drawMultiPolygonGeometry =
|
||||
if (!goog.isDef(fillStyle) && !goog.isDef(strokeStyle)) {
|
||||
return;
|
||||
}
|
||||
if (goog.isDef(strokeStyle)) {
|
||||
if (strokeStyle !== undefined) {
|
||||
goog.asserts.assert(goog.isDef(state.lineWidth),
|
||||
'state.lineWidth should be defined');
|
||||
}
|
||||
@@ -1446,7 +1446,7 @@ ol.render.canvas.PolygonReplay.prototype.setFillStrokeStyles_ = function() {
|
||||
[ol.render.canvas.Instruction.SET_FILL_STYLE, fillStyle]);
|
||||
state.currentFillStyle = state.fillStyle;
|
||||
}
|
||||
if (goog.isDef(strokeStyle)) {
|
||||
if (strokeStyle !== undefined) {
|
||||
goog.asserts.assert(goog.isDef(lineCap), 'lineCap should be defined');
|
||||
goog.asserts.assert(!goog.isNull(lineDash), 'lineDash should not be null');
|
||||
goog.asserts.assert(goog.isDef(lineJoin), 'lineJoin should be defined');
|
||||
@@ -1984,7 +1984,7 @@ ol.render.canvas.ReplayGroup.prototype.replay = function(
|
||||
replays = this.replaysByZIndex_[zs[i].toString()];
|
||||
for (j = 0, jj = ol.render.REPLAY_ORDER.length; j < jj; ++j) {
|
||||
replay = replays[ol.render.REPLAY_ORDER[j]];
|
||||
if (goog.isDef(replay)) {
|
||||
if (replay !== undefined) {
|
||||
replay.replay(context, pixelRatio, transform, viewRotation,
|
||||
skippedFeaturesHash);
|
||||
}
|
||||
@@ -2020,7 +2020,7 @@ ol.render.canvas.ReplayGroup.prototype.replayHitDetection_ = function(
|
||||
replays = this.replaysByZIndex_[zs[i].toString()];
|
||||
for (j = ol.render.REPLAY_ORDER.length - 1; j >= 0; --j) {
|
||||
replay = replays[ol.render.REPLAY_ORDER[j]];
|
||||
if (goog.isDef(replay)) {
|
||||
if (replay !== undefined) {
|
||||
result = replay.replayHitDetection(context, transform, viewRotation,
|
||||
skippedFeaturesHash, featureCallback, opt_hitExtent);
|
||||
if (result) {
|
||||
|
||||
@@ -103,7 +103,7 @@ ol.render.webgl.Immediate.prototype.flush = function() {
|
||||
ol.render.webgl.Immediate.prototype.drawAsync = function(zIndex, callback) {
|
||||
var zIndexKey = zIndex.toString();
|
||||
var callbacks = this.callbacksByZIndex_[zIndexKey];
|
||||
if (goog.isDef(callbacks)) {
|
||||
if (callbacks !== undefined) {
|
||||
callbacks.push(callback);
|
||||
} else {
|
||||
this.callbacksByZIndex_[zIndexKey] = [callback];
|
||||
|
||||
@@ -1078,7 +1078,7 @@ ol.render.webgl.ReplayGroup.prototype.replay = function(context,
|
||||
var i, ii, replay, result;
|
||||
for (i = 0, ii = ol.render.REPLAY_ORDER.length; i < ii; ++i) {
|
||||
replay = this.replays_[ol.render.REPLAY_ORDER[i]];
|
||||
if (goog.isDef(replay)) {
|
||||
if (replay !== undefined) {
|
||||
replay.replay(context,
|
||||
center, resolution, rotation, size, pixelRatio,
|
||||
opacity, brightness, contrast, hue, saturation, skippedFeaturesHash,
|
||||
@@ -1117,7 +1117,7 @@ ol.render.webgl.ReplayGroup.prototype.replayHitDetection_ = function(context,
|
||||
var i, replay, result;
|
||||
for (i = ol.render.REPLAY_ORDER.length - 1; i >= 0; --i) {
|
||||
replay = this.replays_[ol.render.REPLAY_ORDER[i]];
|
||||
if (goog.isDef(replay)) {
|
||||
if (replay !== undefined) {
|
||||
result = replay.replay(context,
|
||||
center, resolution, rotation, size, pixelRatio,
|
||||
opacity, brightness, contrast, hue, saturation,
|
||||
|
||||
@@ -221,7 +221,7 @@ ol.renderer.Layer.prototype.updateAttributions =
|
||||
*/
|
||||
ol.renderer.Layer.prototype.updateLogos = function(frameState, source) {
|
||||
var logo = source.getLogo();
|
||||
if (goog.isDef(logo)) {
|
||||
if (logo !== undefined) {
|
||||
if (goog.isString(logo)) {
|
||||
frameState.logos[logo] = '';
|
||||
} else if (goog.isObject(logo)) {
|
||||
@@ -319,7 +319,7 @@ ol.renderer.Layer.prototype.manageTilePyramid = function(
|
||||
tileGrid.getTileCoordCenter(tile.tileCoord), tileResolution]);
|
||||
}
|
||||
}
|
||||
if (goog.isDef(opt_tileCallback)) {
|
||||
if (opt_tileCallback !== undefined) {
|
||||
opt_tileCallback.call(opt_this, tile);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -25,7 +25,7 @@ ol.ResolutionConstraint.createSnapToResolutions =
|
||||
* @return {number|undefined} Resolution.
|
||||
*/
|
||||
function(resolution, delta, direction) {
|
||||
if (goog.isDef(resolution)) {
|
||||
if (resolution !== undefined) {
|
||||
var z =
|
||||
ol.array.linearFindNearest(resolutions, resolution, direction);
|
||||
z = goog.math.clamp(z + delta, 0, resolutions.length - 1);
|
||||
@@ -53,7 +53,7 @@ ol.ResolutionConstraint.createSnapToPower =
|
||||
* @return {number|undefined} Resolution.
|
||||
*/
|
||||
function(resolution, delta, direction) {
|
||||
if (goog.isDef(resolution)) {
|
||||
if (resolution !== undefined) {
|
||||
var offset;
|
||||
if (direction > 0) {
|
||||
offset = 0;
|
||||
@@ -65,7 +65,7 @@ ol.ResolutionConstraint.createSnapToPower =
|
||||
var oldLevel = Math.floor(
|
||||
Math.log(maxResolution / resolution) / Math.log(power) + offset);
|
||||
var newLevel = Math.max(oldLevel + delta, 0);
|
||||
if (goog.isDef(opt_maxLevel)) {
|
||||
if (opt_maxLevel !== undefined) {
|
||||
newLevel = Math.min(newLevel, opt_maxLevel);
|
||||
}
|
||||
return maxResolution / Math.pow(power, newLevel);
|
||||
|
||||
@@ -16,7 +16,7 @@ ol.RotationConstraintType;
|
||||
* @return {number|undefined} Rotation.
|
||||
*/
|
||||
ol.RotationConstraint.disable = function(rotation, delta) {
|
||||
if (goog.isDef(rotation)) {
|
||||
if (rotation !== undefined) {
|
||||
return 0;
|
||||
} else {
|
||||
return undefined;
|
||||
@@ -30,7 +30,7 @@ ol.RotationConstraint.disable = function(rotation, delta) {
|
||||
* @return {number|undefined} Rotation.
|
||||
*/
|
||||
ol.RotationConstraint.none = function(rotation, delta) {
|
||||
if (goog.isDef(rotation)) {
|
||||
if (rotation !== undefined) {
|
||||
return rotation + delta;
|
||||
} else {
|
||||
return undefined;
|
||||
@@ -51,7 +51,7 @@ ol.RotationConstraint.createSnapToN = function(n) {
|
||||
* @return {number|undefined} Rotation.
|
||||
*/
|
||||
function(rotation, delta) {
|
||||
if (goog.isDef(rotation)) {
|
||||
if (rotation !== undefined) {
|
||||
rotation = Math.floor((rotation + delta) / theta + 0.5) * theta;
|
||||
return rotation;
|
||||
} else {
|
||||
@@ -74,7 +74,7 @@ ol.RotationConstraint.createSnapToZero = function(opt_tolerance) {
|
||||
* @return {number|undefined} Rotation.
|
||||
*/
|
||||
function(rotation, delta) {
|
||||
if (goog.isDef(rotation)) {
|
||||
if (rotation !== undefined) {
|
||||
if (Math.abs(rotation + delta) <= tolerance) {
|
||||
return 0;
|
||||
} else {
|
||||
|
||||
@@ -149,7 +149,7 @@ ol.source.ImageMapGuide.prototype.getImage =
|
||||
var size = [width * pixelRatio, height * pixelRatio];
|
||||
|
||||
var imageUrl = this.imageUrlFunction_(extent, size, projection);
|
||||
if (goog.isDef(imageUrl)) {
|
||||
if (imageUrl !== undefined) {
|
||||
image = new ol.Image(extent, resolution, pixelRatio,
|
||||
this.getAttributions(), imageUrl, this.crossOrigin_,
|
||||
this.imageLoadFunction_);
|
||||
|
||||
@@ -129,7 +129,7 @@ ol.source.TileVector.prototype.forEachFeatureAtCoordinateAndResolution =
|
||||
|
||||
var tileKey = this.getTileKeyZXY_(tileCoord[0], tileCoord[1], tileCoord[2]);
|
||||
var features = tiles[tileKey];
|
||||
if (goog.isDef(features)) {
|
||||
if (features !== undefined) {
|
||||
var i, ii;
|
||||
for (i = 0, ii = features.length; i < ii; ++i) {
|
||||
var feature = features[i];
|
||||
@@ -168,7 +168,7 @@ ol.source.TileVector.prototype.forEachFeatureInExtentAtResolution =
|
||||
for (y = tileRange.minY; y <= tileRange.maxY; ++y) {
|
||||
var tileKey = this.getTileKeyZXY_(z, x, y);
|
||||
var features = tiles[tileKey];
|
||||
if (goog.isDef(features)) {
|
||||
if (features !== undefined) {
|
||||
var i, ii;
|
||||
for (i = 0, ii = features.length; i < ii; ++i) {
|
||||
var result = f.call(opt_this, features[i]);
|
||||
@@ -305,7 +305,7 @@ ol.source.TileVector.prototype.loadFeatures =
|
||||
tileCoord, projection);
|
||||
var url = goog.isNull(urlTileCoord) ? undefined :
|
||||
tileUrlFunction(urlTileCoord, 1, projection);
|
||||
if (goog.isDef(url)) {
|
||||
if (url !== undefined) {
|
||||
tiles[tileKey] = [];
|
||||
var tileSuccess = goog.partial(success, tileKey);
|
||||
if (!goog.isNull(this.tileLoadFunction_)) {
|
||||
|
||||
@@ -164,10 +164,10 @@ ol.source.Vector = function(opt_options) {
|
||||
if (!useSpatialIndex && !goog.isDef(collection)) {
|
||||
collection = new ol.Collection(features);
|
||||
}
|
||||
if (goog.isDef(features)) {
|
||||
if (features !== undefined) {
|
||||
this.addFeaturesInternal(features);
|
||||
}
|
||||
if (goog.isDef(collection)) {
|
||||
if (collection !== undefined) {
|
||||
this.bindFeaturesCollection_(collection);
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ ol.source.Vector.prototype.setupChangeEvents_ = function(featureKey, feature) {
|
||||
ol.source.Vector.prototype.addToIndex_ = function(featureKey, feature) {
|
||||
var valid = true;
|
||||
var id = feature.getId();
|
||||
if (goog.isDef(id)) {
|
||||
if (id !== undefined) {
|
||||
if (!(id.toString() in this.idIndex_)) {
|
||||
this.idIndex_[id.toString()] = feature;
|
||||
} else {
|
||||
@@ -726,7 +726,7 @@ ol.source.Vector.prototype.handleFeatureChange_ = function(event) {
|
||||
}
|
||||
var id = feature.getId();
|
||||
var removed;
|
||||
if (goog.isDef(id)) {
|
||||
if (id !== undefined) {
|
||||
var sid = id.toString();
|
||||
if (featureKey in this.undefIdIndex_) {
|
||||
delete this.undefIdIndex_[featureKey];
|
||||
@@ -827,7 +827,7 @@ ol.source.Vector.prototype.removeFeatureInternal = function(feature) {
|
||||
goog.events.unlistenByKey);
|
||||
delete this.featureChangeKeys_[featureKey];
|
||||
var id = feature.getId();
|
||||
if (goog.isDef(id)) {
|
||||
if (id !== undefined) {
|
||||
delete this.idIndex_[id.toString()];
|
||||
} else {
|
||||
delete this.undefIdIndex_[featureKey];
|
||||
|
||||
@@ -404,7 +404,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
|
||||
goog.array.forEach(l['Dimension'], function(elt, index, array) {
|
||||
var key = elt['Identifier'];
|
||||
var value = elt['default'];
|
||||
if (goog.isDef(value)) {
|
||||
if (value !== undefined) {
|
||||
goog.asserts.assert(goog.array.contains(elt['values'], value),
|
||||
'default value contained in values');
|
||||
} else {
|
||||
@@ -432,7 +432,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
|
||||
|
||||
var wgs84BoundingBox = l['WGS84BoundingBox'];
|
||||
var extent, wrapX;
|
||||
if (goog.isDef(wgs84BoundingBox)) {
|
||||
if (wgs84BoundingBox !== undefined) {
|
||||
var wgs84ProjectionExtent = ol.proj.get('EPSG:4326').getExtent();
|
||||
wrapX = (wgs84BoundingBox[0] == wgs84ProjectionExtent[0] &&
|
||||
wgs84BoundingBox[2] == wgs84ProjectionExtent[2]);
|
||||
|
||||
@@ -172,7 +172,7 @@ ol.style.Style.prototype.setGeometry = function(geometry) {
|
||||
};
|
||||
} else if (goog.isNull(geometry)) {
|
||||
this.geometryFunction_ = ol.style.defaultGeometryFunction;
|
||||
} else if (goog.isDef(geometry)) {
|
||||
} else if (geometry !== undefined) {
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.Geometry,
|
||||
'geometry must be an ol.geom.Geometry instance');
|
||||
this.geometryFunction_ = function() {
|
||||
|
||||
@@ -50,7 +50,7 @@ ol.tilecoord.createFromString = function(str) {
|
||||
* @return {ol.TileCoord} Tile coordinate.
|
||||
*/
|
||||
ol.tilecoord.createOrUpdate = function(z, x, y, opt_tileCoord) {
|
||||
if (goog.isDef(opt_tileCoord)) {
|
||||
if (opt_tileCoord !== undefined) {
|
||||
opt_tileCoord[0] = z;
|
||||
opt_tileCoord[1] = x;
|
||||
opt_tileCoord[2] = y;
|
||||
|
||||
@@ -79,7 +79,7 @@ ol.TileRange.boundingTileRange = function(var_args) {
|
||||
* @return {ol.TileRange} Tile range.
|
||||
*/
|
||||
ol.TileRange.createOrUpdate = function(minX, maxX, minY, maxY, tileRange) {
|
||||
if (goog.isDef(tileRange)) {
|
||||
if (tileRange !== undefined) {
|
||||
tileRange.minX = minX;
|
||||
tileRange.maxX = maxX;
|
||||
tileRange.minY = minY;
|
||||
|
||||
@@ -175,7 +175,7 @@ goog.inherits(ol.View, ol.Object);
|
||||
ol.View.prototype.calculateCenterRotate = function(rotation, anchor) {
|
||||
var center;
|
||||
var currentCenter = this.getCenter();
|
||||
if (goog.isDef(currentCenter)) {
|
||||
if (currentCenter !== undefined) {
|
||||
center = [currentCenter[0] - anchor[0], currentCenter[1] - anchor[1]];
|
||||
ol.coordinate.rotate(center, rotation - this.getRotation());
|
||||
ol.coordinate.add(center, anchor);
|
||||
@@ -421,7 +421,7 @@ ol.View.prototype.getZoom = function() {
|
||||
var offset;
|
||||
var resolution = this.getResolution();
|
||||
|
||||
if (goog.isDef(resolution)) {
|
||||
if (resolution !== undefined) {
|
||||
var res, z = 0;
|
||||
do {
|
||||
res = this.constrainResolution(this.maxResolution_, z);
|
||||
@@ -564,7 +564,7 @@ ol.View.prototype.isDef = function() {
|
||||
* @api stable
|
||||
*/
|
||||
ol.View.prototype.rotate = function(rotation, opt_anchor) {
|
||||
if (goog.isDef(opt_anchor)) {
|
||||
if (opt_anchor !== undefined) {
|
||||
var center = this.calculateCenterRotate(rotation, opt_anchor);
|
||||
this.setCenter(center);
|
||||
}
|
||||
@@ -695,7 +695,7 @@ ol.View.createResolutionConstraint_ = function(options) {
|
||||
|
||||
// user provided maxResolution takes precedence
|
||||
maxResolution = options.maxResolution;
|
||||
if (goog.isDef(maxResolution)) {
|
||||
if (maxResolution !== undefined) {
|
||||
minZoom = 0;
|
||||
} else {
|
||||
maxResolution = defaultMaxResolution / Math.pow(zoomFactor, minZoom);
|
||||
|
||||
@@ -367,11 +367,11 @@ ol.webgl.Context.createTexture_ = function(gl, opt_wrapS, opt_wrapT) {
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
||||
|
||||
if (goog.isDef(opt_wrapS)) {
|
||||
if (opt_wrapS !== undefined) {
|
||||
gl.texParameteri(
|
||||
goog.webgl.TEXTURE_2D, goog.webgl.TEXTURE_WRAP_S, opt_wrapS);
|
||||
}
|
||||
if (goog.isDef(opt_wrapT)) {
|
||||
if (opt_wrapT !== undefined) {
|
||||
gl.texParameteri(
|
||||
goog.webgl.TEXTURE_2D, goog.webgl.TEXTURE_WRAP_T, opt_wrapT);
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ ol.xml.getLocalName_ = function(node) {
|
||||
*/
|
||||
ol.xml.getLocalNameIE_ = function(node) {
|
||||
var localName = node.localName;
|
||||
if (goog.isDef(localName)) {
|
||||
if (localName !== undefined) {
|
||||
return localName;
|
||||
}
|
||||
var baseName = node.baseName;
|
||||
@@ -227,7 +227,7 @@ ol.xml.getAttributeNS_ = function(node, namespaceURI, name) {
|
||||
ol.xml.getAttributeNSActiveX_ = function(node, namespaceURI, name) {
|
||||
var attributeValue = '';
|
||||
var attributeNode = ol.xml.getAttributeNodeNS(node, namespaceURI, name);
|
||||
if (goog.isDef(attributeNode)) {
|
||||
if (attributeNode !== undefined) {
|
||||
attributeValue = attributeNode.nodeValue;
|
||||
}
|
||||
return attributeValue;
|
||||
@@ -363,7 +363,7 @@ ol.xml.makeArrayExtender = function(valueReader, opt_this) {
|
||||
*/
|
||||
function(node, objectStack) {
|
||||
var value = valueReader.call(opt_this, node, objectStack);
|
||||
if (goog.isDef(value)) {
|
||||
if (value !== undefined) {
|
||||
goog.asserts.assert(goog.isArray(value),
|
||||
'valueReader function is expected to return an array of values');
|
||||
var array = /** @type {Array.<*>} */
|
||||
@@ -393,7 +393,7 @@ ol.xml.makeArrayPusher = function(valueReader, opt_this) {
|
||||
function(node, objectStack) {
|
||||
var value = valueReader.call(goog.isDef(opt_this) ? opt_this : this,
|
||||
node, objectStack);
|
||||
if (goog.isDef(value)) {
|
||||
if (value !== undefined) {
|
||||
var array = objectStack[objectStack.length - 1];
|
||||
goog.asserts.assert(goog.isArray(array),
|
||||
'objectStack is supposed to be an array of arrays');
|
||||
@@ -420,7 +420,7 @@ ol.xml.makeReplacer = function(valueReader, opt_this) {
|
||||
function(node, objectStack) {
|
||||
var value = valueReader.call(goog.isDef(opt_this) ? opt_this : this,
|
||||
node, objectStack);
|
||||
if (goog.isDef(value)) {
|
||||
if (value !== undefined) {
|
||||
objectStack[objectStack.length - 1] = value;
|
||||
}
|
||||
});
|
||||
@@ -448,7 +448,7 @@ ol.xml.makeObjectPropertyPusher =
|
||||
function(node, objectStack) {
|
||||
var value = valueReader.call(goog.isDef(opt_this) ? opt_this : this,
|
||||
node, objectStack);
|
||||
if (goog.isDef(value)) {
|
||||
if (value !== undefined) {
|
||||
var object = /** @type {Object} */
|
||||
(objectStack[objectStack.length - 1]);
|
||||
var property = goog.isDef(opt_property) ?
|
||||
@@ -482,7 +482,7 @@ ol.xml.makeObjectPropertySetter =
|
||||
function(node, objectStack) {
|
||||
var value = valueReader.call(goog.isDef(opt_this) ? opt_this : this,
|
||||
node, objectStack);
|
||||
if (goog.isDef(value)) {
|
||||
if (value !== undefined) {
|
||||
var object = /** @type {Object} */
|
||||
(objectStack[objectStack.length - 1]);
|
||||
var property = goog.isDef(opt_property) ?
|
||||
@@ -658,9 +658,9 @@ ol.xml.parseNode = function(parsersNS, node, objectStack, opt_this) {
|
||||
var n;
|
||||
for (n = node.firstElementChild; !goog.isNull(n); n = n.nextElementSibling) {
|
||||
var parsers = parsersNS[n.namespaceURI];
|
||||
if (goog.isDef(parsers)) {
|
||||
if (parsers !== undefined) {
|
||||
var parser = parsers[n.localName];
|
||||
if (goog.isDef(parser)) {
|
||||
if (parser !== undefined) {
|
||||
parser.call(opt_this, n, objectStack);
|
||||
}
|
||||
}
|
||||
@@ -715,10 +715,10 @@ ol.xml.serialize = function(
|
||||
var value, node;
|
||||
for (var i = 0; i < length; ++i) {
|
||||
value = values[i];
|
||||
if (goog.isDef(value)) {
|
||||
if (value !== undefined) {
|
||||
node = nodeFactory.call(opt_this, value, objectStack,
|
||||
goog.isDef(opt_keys) ? opt_keys[i] : undefined);
|
||||
if (goog.isDef(node)) {
|
||||
if (node !== undefined) {
|
||||
serializersNS[node.namespaceURI][node.localName]
|
||||
.call(opt_this, node, value, objectStack);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user