Prevent duplicate node title in SVG renderer.
This commit is contained in:
@@ -252,9 +252,15 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
||||
if (style.graphicTitle) {
|
||||
node.setAttributeNS(null, "title", style.graphicTitle);
|
||||
//Standards-conformant SVG
|
||||
var label = this.nodeFactory(null, "title");
|
||||
label.textContent = style.graphicTitle;
|
||||
node.appendChild(label);
|
||||
// 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;
|
||||
} else {
|
||||
var label = this.nodeFactory(null, "title");
|
||||
label.textContent = style.graphicTitle;
|
||||
node.appendChild(label);
|
||||
}
|
||||
}
|
||||
if (style.graphicWidth && style.graphicHeight) {
|
||||
node.setAttributeNS(null, "preserveAspectRatio", "none");
|
||||
|
||||
Reference in New Issue
Block a user