diff --git a/src/ol/parser/ogc/sldparser_v1.js b/src/ol/parser/ogc/sldparser_v1.js index ed9757b038..a1516d8c5a 100644 --- a/src/ol/parser/ogc/sldparser_v1.js +++ b/src/ol/parser/ogc/sldparser_v1.js @@ -342,10 +342,10 @@ ol.parser.ogc.SLD_v1 = function() { 'UserStyle': function(style) { var node = this.createElementNS('sld:UserStyle'); var name = style.getName(), title = style.getTitle(); - if (!goog.isNull(name)) { + if (goog.isDef(name)) { this.writeNode('Name', name, null, node); } - if (!goog.isNull(title)) { + if (goog.isDef(title)) { this.writeNode('Title', title, null, node); } // TODO sorting by zIndex @@ -370,11 +370,12 @@ ol.parser.ogc.SLD_v1 = function() { 'Rule': function(rule) { var node = this.createElementNS('sld:Rule'); var filter = rule.getFilter(); - if (!goog.isNull(rule.getName())) { - this.writeNode('Name', rule.getName(), null, node); + var name = rule.getName(), title = rule.getTitle(); + if (goog.isDef(name)) { + this.writeNode('Name', name, null, node); } - if (!goog.isNull(rule.getTitle())) { - this.writeNode('Title', rule.title, null, node); + if (goog.isDef(title)) { + this.writeNode('Title', title, null, node); } if (rule.elseFilter === true) { this.writeNode('ElseFilter', null, null, node); diff --git a/src/ol/style/rule.js b/src/ol/style/rule.js index 3495422459..d8234de95b 100644 --- a/src/ol/style/rule.js +++ b/src/ol/style/rule.js @@ -55,18 +55,18 @@ ol.style.Rule = function(options) { options.maxResolution : Infinity; /** - * @type {?string} + * @type {string|undefined} * @private */ this.name_ = goog.isDef(options.name) ? - options.name : null; + options.name : undefined; /** - * @type {?string} + * @type {string|undefined} * @private */ this.title_ = goog.isDef(options.title) ? - options.title : null; + options.title : undefined; }; @@ -119,7 +119,7 @@ ol.style.Rule.prototype.getMaxResolution = function() { /** - * @return {?string} + * @return {string|undefined} */ ol.style.Rule.prototype.getName = function() { return this.name_; @@ -127,7 +127,7 @@ ol.style.Rule.prototype.getName = function() { /** - * @return {?string} + * @return {string|undefined} */ ol.style.Rule.prototype.getTitle = function() { return this.title_; diff --git a/src/ol/style/style.js b/src/ol/style/style.js index 224ec2578c..c8d70ef635 100644 --- a/src/ol/style/style.js +++ b/src/ol/style/style.js @@ -41,18 +41,18 @@ ol.style.Style = function(options) { options.symbolizers : []; /** - * @type {?string} + * @type {string|undefined} * @private */ this.name_ = goog.isDef(options.name) ? - options.name : null; + options.name : undefined; /** - * @type {?string} + * @type {string|undefined} * @private */ this.title_ = goog.isDef(options.title) ? - options.title : null; + options.title : undefined; }; @@ -247,7 +247,7 @@ ol.style.Style.prototype.getSymbolizers = function() { /** - * @return {?string} + * @return {string|undefined} */ ol.style.Style.prototype.getName = function() { return this.name_; @@ -255,7 +255,7 @@ ol.style.Style.prototype.getName = function() { /** - * @return {?string} + * @return {string|undefined} */ ol.style.Style.prototype.getTitle = function() { return this.title_;