neveldo / jQuery-Mapael

jQuery plugin based on raphael.js that allows you to display dynamic vector maps
https://www.vincentbroute.fr/mapael/
MIT License
1.01k stars 195 forks source link

Prevent mapael from raising an error if the legend container doesn't exist #335

Closed neveldo closed 7 years ago

neveldo commented 7 years ago

1 - The option "display" should be checked before checking the existence of a container with a class 'cssClass' (otherwise, users are forced to add a legend container even if just want to display a choropleth without displaying the related legend)

2 - I think that, even if the option 'display' is set to true, we shouldn't rise an error if the container doesn't exist. In fact, some user define their own default options along with some default ones for the legend (in order to customize fonts, colors, etc), and they extend their default options object in order to display both legended and non-legended maps. As the 'display' option is set to true by default within mapael, it will raise an error for the non-legended maps in this case.

neveldo commented 7 years ago

Hmm, I will check ASAP why my pull-request broke the unit tests pass (don't know if it's related with my update)

neveldo commented 7 years ago

Hi @Indigo744 ,

You are right, thanks, I just saw it in the travis log. It's now fixed (I also fixed the conflict)

Indigo744 commented 7 years ago

It is a good fix :) I'll go ahead and squash it to master.