Don't inherit SVG style properties from the environment. (#1089)

* Don't inherit SVG style properties from the environment.

We don't want to inherit styles that affect SVG painting unless those
styles also affect regular text rendering. This patch adds styles
to the stylesheet so that every svg element in KaTeX output starts
off with a known set of basic fill and stroke attributes.

This should resolve issue #1088

* Default to stroke:none for <path> elements
This commit is contained in:
David Flanagan
2018-01-25 06:01:37 -08:00
committed by Kevin Barabash
parent 63f541b6e6
commit 7b5083f982

View File

@@ -441,13 +441,30 @@
position: absolute; // absolute relative to parent
width: 100%;
// We want to inherit colors from our environment
fill: currentColor;
stroke: currentColor;
// But path elements should not have an outline by default
// that would make them bigger than we expect.
path {
fill: currentColor;
stroke: none;
}
line {
stroke: currentColor;
}
// And we don't want to inherit any other style properties
// that could affect SVG rendering without affecting font
// rendering. So we reset these properties to their default
// values for every <svg> element.
// See https://www.w3.org/TR/SVG/painting.html
fill-rule: nonzero;
fill-opacity: 1;
stroke-width: 1;
stroke-linecap: butt;
stroke-linejoin: miter;
stroke-miterlimit: 4;
stroke-dasharray: none;
stroke-dashoffset: 0;
stroke-opacity: 1;
}
.vertical-separator svg {