only set popup content if values are defined

git-svn-id: http://svn.openlayers.org/trunk/openlayers@455 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-05-29 18:20:41 +00:00
parent e2782f1ad5
commit 8a21a1dba4

View File

@@ -9,6 +9,7 @@ OpenLayers.Layer.Text.prototype =
/** store url of text file /** store url of text file
* @type str */ * @type str */
location:null, location:null,
/** /**
* @constructor * @constructor
* *
@@ -74,7 +75,6 @@ OpenLayers.Layer.Text.prototype =
} }
if (set) { if (set) {
var data = new Object(); var data = new Object();
if (url != null) { if (url != null) {
data.icon = new OpenLayers.Icon(url, data.icon = new OpenLayers.Icon(url,
iconSize, iconSize,
@@ -90,7 +90,9 @@ OpenLayers.Layer.Text.prototype =
} }
} }
data['popupContentHTML'] = '<h2>'+title+'</h2><p>'+description+'</p>'; if ((title != null) && (description != null)) {
data['popupContentHTML'] = '<h2>'+title+'</h2><p>'+description+'</p>';
}
var feature = new OpenLayers.Feature(this, location, data); var feature = new OpenLayers.Feature(this, location, data);
var marker = feature.createMarker(); var marker = feature.createMarker();
marker.events.register('click', feature, this.markerClick); marker.events.register('click', feature, this.markerClick);