here's simple html with one span item and a triangle CSS pseudo element. I want the triangle rotate on each click, first rotate 90 degrees next click come back to original state.
When class collapsed is toggled also collapsed::before should be applied, isn't it?
The yellow color (just for debugging) but the triangle is not rotating.
What am I missing?
function collapseTree(el){
    el.classList.toggle("collapsed");
}.span1::before{
       content: "\25B6";
      color: black;
}
.collapsed::before{
 
  -ms-transform: rotate(90deg); /* IE 9 */
  -webkit-transform: rotate(90deg); /* Safari */
  transform: rotate(90deg);  
}
.collapsed{
  background: yellow;  
}
.span1{
  border: indigo 1px solid;
      color: black;
      cursor: pointer;
     } <span id="span1" class="span1" onclick="collapseTree(this)">Span</span> 
    