title: Highlighting Leaflet map items when using Marker Cluster plugin
body: <p>I'm using Leaflet together with Marker Cluster plugin on AngularJS app.</p>
  
  <p>When selecting on a map's item I need to highlight it. Because I'm using divIcons, I'm adding or removing class, also setting colour if item is not a marker.</p>
  
  <p>For that I'm saving last clicked item in the memory so that when the next item is selected, I can de-highlight the previous item and highlight current one.</p>
  
  <pre><code>        // De-highlight previous item
          if (lastClickedLayer) {
              if (lastClickedLayer instanceof L.Marker) {
                  lastClickedLayer._icon.classList.remove('marker-highlighted');
              }
              else {
                  lastClickedLayer.setStyle({
                      color: (lastClickedLayer.feature.status === 'active') ? '#43A7E0' : '#EB7938'
                  });
              }
          }
  
          // Highlight item on the map
          lastClickedLayer = e.layer;
  
          if (e.layer instanceof L.Marker) {
              e.layer._icon.classList.add('marker-highlighted');
          }
          else {
              e.layer.setStyle({
                  color: '#32C9AC'
              });
          }
  </code></pre>
  
  <p>Everything would be fine if not Marker Clustering! When I zoom out and get a cluster of current markers (let's say I select one marker first) and then zoom in back to that cluster, my selected marker does not have assigned 'marker-highlighted' class.</p>
  
  <p>Also, If I'm at the vey end of zoom-in and clusters are showing spider-webs of markers (or how they're called), when cluster in which is selected marker is closed, I can't seem to unset class of that layer - it's just gets undefined.</p>
  
  <p>How could I possible solve my issues?</p>
  
  <p>Oh and my map items are kept as a new L.MarkerClusterGroup().</p>