This function displays everything in the marker object:
function printObject(o) {
var out = '';
for (var p in o) {
out += p + ': ' + o[p] + '\n';
}
alert(out);
}
You can can take a peek at all the properties of the marker by calling the function and passing the marker object to it:
printObject(markerobject);
After printing the object, I found out I could print the icon object directly like this:
alert(markerobject._icon);
After viewing the properties of the icon object, I noticed that my custom div icon was displayed in the outerHTML portion of the _icon attributes.
Printing _icon.outerHTML shows the div icon stuff:
<div class="leaflet-marker-icon whitediv leaflet-zoom-animated leaflet-clickable" title="Resorts" ... etc
From there I just searched for the classes that I needed to identify like this:
if(markerObject._icon.outerHTML.search("bluediv")>0)
{
// then this marker was set with my bluediv class.. so change its icon to a different shape, but with a blue color...
}
The ability to access the marker object attributes without relying on the built-in methods is a huge help for certain tasks.
Hope this helps someone.