Opened 3 years ago

Closed 3 years ago

#21351 closed defect (fixed)

SVG images on detail pages have duplicate id attributes to the divs

Reported by: irl Owned by: irl
Priority: Low Milestone:
Component: Metrics/Relay Search Version:
Severity: Normal Keywords:
Cc: Actual Points:
Parent ID: #21274 Points:
Reviewer: Sponsor:

Description

We shouldn't have duplicate id attributes on elements in the DOM.

e.g.

<div id="bw_month" class="graph">

and

<svg height="342" width="550" xmlns="http://www.w3.org/2000/svg" version="1.1" id="bw_month">

Selecting Low priority for now, as this doesn't seem to be causing breakage, but it might be dangerous in browsers I haven't tested and this may need to be increased.

Child Tickets

Change History (3)

comment:1 Changed 3 years ago by cypherpunks

A quick grep shows there is no CSS that uses the bw_month id. The id is only used by the JS code that generates the SVG graphs to know where to inject the graphs. This code also injects the duplicate id for some unknown reason. The inline patch fixes the issue by simply removing the injection of the duplicate id.

diff --git a/js/views/details/main.js b/js/views/details/main.js
index e73ac4a..97846be 100644
--- a/js/views/details/main.js
+++ b/js/views/details/main.js
@@ -32,7 +32,6 @@ define([
                 width = 550 - margin.left - margin.right,
                 height = 342 - margin.top - margin.bottom;
             var svg = d3.select("#" + g).append("svg:svg")
-                .attr("id", g)
                 .attr("version", 1.1)
                 .attr("xmlns", "http://www.w3.org/2000/svg")
                 .attr("width", width + margin.left + margin.right)

comment:2 Changed 3 years ago by cypherpunks

Status: newneeds_review

comment:3 Changed 3 years ago by irl

Resolution: fixed
Status: needs_reviewclosed

LGTM. Merged in 849712efdf623af8cfcde73bc0a44ad2b70a4e96.

Thanks for your work. (:

Note: See TracTickets for help on using tickets.