Leaflet/Leaflet — pull request #1726 by robpvn (2013-05-31 12:27:43+00:00)
Title: Reuse icon DOM

This fixes issue #561 and related issues that occur when using setIcon in an eventhandler like dragstart or mouseover. It includes a new debug/tests file that can be used to verify the results.

The fix works by checking if a marker has a pre-existing DOM img element, and only creating a new element if there is none. Otherwise, it will take the existing element and update its src and style information to take on the appearance of the new icon.

No new automated tests have been added, but all the previous ones still pass.