Skip to content

CIF simulator: CSS attributes after attributes with vendor-specific names are wrongly ignored

The problem

Batik's CSS parser does not support CSS identifiers starting with a vendor-specific prefix: https://issues.apache.org/jira/browse/BATIK-1368.

This renders a yellow rectangle, as expected:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" version="1.1" width="100" height="100">
  <rect x="20" y="20" width="20" height="20" style="a:1; fill: yellow;" />
</svg>

This renders a black rectangle, since the -a attribute name can't be recognized as a CSS identifier and thus the entire style attribute fails parsing and is ignored:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" version="1.1" width="100" height="100">
  <rect x="20" y="20" width="20" height="20" style="-a:1; fill: yellow;" />
</svg>

Batik issues:

Temporary workaround in our code for the Batik issues:

Original description

When generating an executable html simulation file, the color of text elements is not always correctly applied. I did a few tests, and it seems that when a text element has the standard color (i.e. black), it is correctly overwritten during html simulation. However, if a specific color is given to a text element in the svg, this color is not "overwritten" during html simulation.

I have created a small example where this difference can be seen.

GenerateHTML.tooldef main.cif main.svg Simulatie.html Simulation.tooldef

In this example, two text elements are given the color yellow during simulation. One text element has the original black color in the svg, while the other is given the color red in the svg:
image

During simulation in ESCET, the color of both text elements is correctly set to yellow:
image

However, during html simulation, the color of the red text element is not correctly changed to yellow:
image

Edited by Dennis Hendriks