I am quite lame with CSS, but noticed something about this helper.
var classname = component.get("v.class");
var containerClassName = [
prefix+"icon__container",
prefix+"icon-"+category+"-"+name,
classname
].join(' ');
var iconClassName = prefix+"icon "+prefix+"icon--" + size;
component.set("v.containerClass", containerClassName);
var svgroot = document.createElementNS(svgns, "svg");
svgroot.setAttribute("class", iconClassName);
As you can see, SVG element class is actually generated for you, while in component itself it says:
<aura:attribute name="class" description="the class of this SVG tag, can be use for CSS purpose" />
<aura:attribute name="containerClass" description="Container class name for span container of icon" />
So if I put something like:
<c:svg svgPath="/resource/SLDS0102/assets/icons/utility-sprite/svg/symbols.svg#delete"
category="utility" name="delete" class="slds-button__icon" />
It won't actually be visible on my screen. classname is actually getting sent on the container.
Is this correct or do just don't know how to set the styles correctly?
Best Answer
This is a bug in the helper code -- I submitted a pull request with a fix for this several weeks ago, and it's been approved but hasn't been merged yet.
It changes the renderIcon code to:
Here's the pull request -- hopefully they'll get around to merging it soon.
UPDATE: the helper code on the SLDS site is now showing the corrected code.