Really too bad we don't have this option. I would like to write a plugin for that some day.
FOR ANYONE TRYING TO ADD CLASSES/ATTRIBUTES TO A SVG LOADED ON A WEB BROWSER:
I needed to add some attributes to a SVG that is loaded inside a HTML page. On my case, I had a Javascript array with all my elements.
I solved my problem by adding a Javascript code that checks for the attributes I need and if its not present, adds it. On my case, I didn't need to add classes, but attributes:
//get the element
var map = document.getElementById(Bins[i].Map);
if (map != undefined) {
//check and add attribute if not found
if (map.getAttribute("binid") == undefined)
map.setAttribute("binid", Bins[i].Id);
if (map.getAttribute("onmouseover") == undefined)
map.setAttribute("onmouseover", "Hovered(this);");
if (map.getAttribute("onmouseout") == undefined)
map.setAttribute("onmouseout", "UnHovered(this);");
if (map.getAttribute("onclick") == undefined)
map.setAttribute("onclick", "Clicked(this);");
}
in this case, I add the attributes I need to the element "map". I run this function every time the page loads. I think somebody could use the same type of code to add classes to those elements.