Rename style.graphicTitle to style.title (the former is now deprecated)

This commit is contained in:
Frederic Junod
2012-05-15 12:46:41 +02:00
parent d01f57d3e6
commit 8268616ec8
5 changed files with 17 additions and 12 deletions

View File

@@ -240,16 +240,17 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
style = style || node._style;
options = options || node._options;
if (style.graphicTitle) {
node.setAttributeNS(null, "title", style.graphicTitle);
var title = style.title || style.graphicTitle;
if (title) {
node.setAttributeNS(null, "title", title);
//Standards-conformant SVG
// Prevent duplicate nodes. See issue https://github.com/openlayers/openlayers/issues/92
var titleNode = node.getElementsByTagName("title");
if (titleNode.length > 0) {
titleNode[0].firstChild.textContent = style.graphicTitle;
titleNode[0].firstChild.textContent = title;
} else {
var label = this.nodeFactory(null, "title");
label.textContent = style.graphicTitle;
label.textContent = title;
node.appendChild(label);
}
}