commit 557e93e505a6bfe86eea9cb0059473cb88b1a8ec
parent c4da088220929b63af5e36915f1225d24706df14
Author: Davide P. Cervone <dpvc@union.edu>
Date: Wed, 17 Apr 2013 09:02:33 -0400
Allow \color to override link color in SVG output. Resolves issue #427.
Diffstat:
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/unpacked/jax/output/SVG/config.js b/unpacked/jax/output/SVG/config.js
@@ -24,7 +24,7 @@
MathJax.OutputJax.SVG = MathJax.OutputJax({
id: "SVG",
- version: "2.1.1",
+ version: "2.1.2",
directory: MathJax.OutputJax.directory + "/SVG",
extensionDir: MathJax.OutputJax.extensionDir + "/SVG",
autoloadDir: MathJax.OutputJax.directory + "/SVG/autoload",
diff --git a/unpacked/jax/output/SVG/jax.js b/unpacked/jax/output/SVG/jax.js
@@ -60,7 +60,7 @@
width: "100%"
},
- ".MathJax_SVG svg a > g, .MathJax_SVG_Display svg a > g": {
+ ".mjx-href": {
fill: "blue", stroke: "blue"
},
@@ -1027,19 +1027,17 @@
// for svg element, put <a> inside the main <g> element
var g = svg.element.firstChild;
while (g.firstChild) {a.appendChild(g.firstChild)}
- g.appendChild(a);
+ g.appendChild(a); this.SVGaddClass(g,"mjx-href");
+ g.removeAttribute("fill"); g.removeAttribute("stroke");
} else {
- // if removeable, move contents of <g> to <a>, otherise move element to <a>
- if (svg.removeable && svg.element.nodeName === "g") {
- while (svg.element.firstChild) {a.appendChild(svg.element.firstChild)}
- } else {a.appendChild(svg.element)}
- svg.element = a;
+ this.SVGaddClass(svg.element,"mjx-href");
+ a.appendChild(svg.element); svg.element = a;
}
svg.removeable = false;
}
if (SVG.config.addMMLclasses) {
+ this.SVGaddClass(svg.element,"mjx-svg-"+this.type);
svg.removeable = false;
- svg.element.setAttribute("className","mjx-svg-"+this.type);
}
var style = this.style;
if (style && svg.element) {
@@ -1049,6 +1047,10 @@
if (svg.removeable) {svg.removeable = svg.element.style.cssText === ""}
}
},
+ SVGaddClass: function (node,name) {
+ var classes = node.getAttribute("class");
+ node.setAttribute("class",(classes ? classes+" " : "")+name);
+ },
//
// WebKit currently scrolls to the BOTTOM of an svg element if it contains the
// target of the link, so implement link by hand, to the containing span element.