Separators between possible hidden spans
I have a number of gaps forming an enumeration:
<span class="item">Value 1</span><span class="delim">, </span>
<span class="item">Value 2</span><span class="delim">, </span>
<span class="item">Value 3</span>
This is normal when everyone itemhas it display:inline, but when I add a class c display:noneto the second itemrange, the result is as follows:
Value 1, Value 2
I could not find a solution to this problem in CSS, and using JS is undesirable (the code that switches the visibility is already very complicated).
Any ideas?
UPDATE. . Currently, all proposed solutions do not take into account the fact that ANY of the itemspans can be hidden or visible, and not just the second. The problem is not only a double comma in the middle, but also an extra comma at the end.