title: Leaflet path: how can I set a css class?
body: <p>Well the title says it all but here is some code so you see what i mean.</p>
  
  <pre><code>function eachFeature(feature, layer) {
       layer.on({
           mouseover: highlightFeature,
           mouseout: resetHighlight,
       });
  }
  geojson = L.geoJson(geojson_raw, { style: style, onEachFeature: eachFeature });
  geojson.addTo(map);
  </code></pre>
  
  <p><code>geojson_raw</code> is the geojson object which is held in a javascript variable.
  <code>style</code> is just the function that returns an object with some style attributes.
  <code>highlightFeature</code> / <code>resetHighlight</code> are functions to change these styles according to mousein/out events.</p>
  
  <p>So this code works and I already know how to change styles by reacting on user events.
  But how can I set an actual css-classname on the paths that are created from my geojson data? Later in my code I would like to select paths by a specific classname.</p>
  
  <p><em>UPDATE</em></p>
  
  <p>2 years later I stumbled over this issue once again. And it took me 2 hours to solve the mystery. The accepted answer below does work, BUT there is a catch. It only works if you set the cssClass <strong>before</strong> you call <code>addTo(map)</code> on the layer. After finally digging it up in the source code it became clear that leaflet only sets the cssClass when each path gets initialised.</p>