Merge pull request #98 from towa48/master
Avoid duplicate feature title nodes. r=me
This commit is contained in:
@@ -252,9 +252,15 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
|||||||
if (style.graphicTitle) {
|
if (style.graphicTitle) {
|
||||||
node.setAttributeNS(null, "title", style.graphicTitle);
|
node.setAttributeNS(null, "title", style.graphicTitle);
|
||||||
//Standards-conformant SVG
|
//Standards-conformant SVG
|
||||||
var label = this.nodeFactory(null, "title");
|
// Prevent duplicate nodes. See issue https://github.com/openlayers/openlayers/issues/92
|
||||||
label.textContent = style.graphicTitle;
|
var titleNode = node.getElementsByTagName("title");
|
||||||
node.appendChild(label);
|
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) {
|
if (style.graphicWidth && style.graphicHeight) {
|
||||||
node.setAttributeNS(null, "preserveAspectRatio", "none");
|
node.setAttributeNS(null, "preserveAspectRatio", "none");
|
||||||
|
|||||||
@@ -183,9 +183,15 @@ OpenLayers.Renderer.SVG2 = OpenLayers.Class(OpenLayers.Renderer.NG, {
|
|||||||
if (style.graphicTitle) {
|
if (style.graphicTitle) {
|
||||||
node.setAttributeNS(null, "title", style.graphicTitle);
|
node.setAttributeNS(null, "title", style.graphicTitle);
|
||||||
//Standards-conformant SVG
|
//Standards-conformant SVG
|
||||||
var label = this.nodeFactory(null, "title");
|
// Prevent duplicate nodes. See issue https://github.com/openlayers/openlayers/issues/92
|
||||||
label.textContent = style.graphicTitle;
|
var titleNode = node.getElementsByTagName("title");
|
||||||
node.appendChild(label);
|
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) {
|
if (style.graphicWidth && style.graphicHeight) {
|
||||||
node.setAttributeNS(null, "preserveAspectRatio", "none");
|
node.setAttributeNS(null, "preserveAspectRatio", "none");
|
||||||
|
|||||||
Reference in New Issue
Block a user