Remove unnecessary goog.isDefAndNotNull() calls

This commit is contained in:
Tim Schaub
2015-09-27 12:06:12 -06:00
parent ed3dcd636f
commit b48cabee28
19 changed files with 46 additions and 57 deletions

View File

@@ -394,7 +394,7 @@ ol.format.KML.readFlatCoordinates_ = function(node) {
*/
ol.format.KML.readStyleUrl_ = function(node) {
var s = goog.string.trim(ol.xml.getAllTextContent(node, false));
if (goog.isDefAndNotNull(node.baseURI)) {
if (node.baseURI) {
return goog.Uri.resolve(node.baseURI, s).toString();
} else {
return s;
@@ -410,7 +410,7 @@ ol.format.KML.readStyleUrl_ = function(node) {
*/
ol.format.KML.readURI_ = function(node) {
var s = ol.xml.getAllTextContent(node, false);
if (goog.isDefAndNotNull(node.baseURI)) {
if (node.baseURI) {
return goog.Uri.resolve(node.baseURI, goog.string.trim(s)).toString();
} else {
return goog.string.trim(s);
@@ -980,8 +980,7 @@ ol.format.KML.readPolygon_ = function(node, objectStack) {
var flatLinearRings = ol.xml.pushParseAndPop(
/** @type {Array.<Array.<number>>} */ ([null]),
ol.format.KML.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack);
if (goog.isDefAndNotNull(flatLinearRings) &&
!goog.isNull(flatLinearRings[0])) {
if (flatLinearRings && !goog.isNull(flatLinearRings[0])) {
var polygon = new ol.geom.Polygon(null);
var flatCoordinates = flatLinearRings[0];
var ends = [flatCoordinates.length];
@@ -1721,7 +1720,7 @@ ol.format.KML.prototype.readSharedStyle_ = function(node, objectStack) {
var style = ol.format.KML.readStyle_(node, objectStack);
if (style) {
var styleUri;
if (goog.isDefAndNotNull(node.baseURI)) {
if (node.baseURI) {
styleUri = goog.Uri.resolve(node.baseURI, '#' + id).toString();
} else {
styleUri = '#' + id;
@@ -1751,7 +1750,7 @@ ol.format.KML.prototype.readSharedStyleMap_ = function(node, objectStack) {
return;
}
var styleUri;
if (goog.isDefAndNotNull(node.baseURI)) {
if (node.baseURI) {
styleUri = goog.Uri.resolve(node.baseURI, '#' + id).toString();
} else {
styleUri = '#' + id;
@@ -2267,7 +2266,7 @@ ol.format.KML.writePlacemark_ = function(node, feature, objectStack) {
var /** @type {ol.xml.NodeStackItem} */ context = {node: node};
// set id
if (goog.isDefAndNotNull(feature.getId())) {
if (feature.getId()) {
node.setAttribute('id', feature.getId());
}