Change 'prefer canvas' setting per leaflet map
<p>I'm using <a href="http://leafletjs.com/reference.html" rel="nofollow">Leaflet</a> (v 0.7.7). It expects setting L_PREFER_CANVAS as a script tag, which is global. I wish to create 2 maps on same page, one with L_PREFER_CANVAS  flag ON and once with OFF. How can I do that ?</p>

<p>1) I've tried setting window.L_PREFER_CANVAS before the map creation.</p>

<p>2) I've tried creating my layers with extended classes like this </p>

<pre><code>var MyCircle = L.Circle.extend({
            statics: {
                CANVAS: true,
                SVG: false
            }
        });
</code></pre>

<p>then using 'new MyCircle' instead of 'L.circle'. </p>

<p>Neither of the two methods have the desired effect, even though the map is rendered successfully</p>

<p>I'm looking into leaflet code but i'm not very comfortable with its inner workings yet, due to lack of js sorcery know-how i believe</p>

<p>Edit: A thing that partly works is cloning the entire leaflet source under a new object (M.* instead of L.<em>), and keep my desired flag enabled for it. But its clumsy and breaks with plugins which add their functionality to L.</em> classes. Thereby requiring more duplication to fix, which i'm trying to avoid</p>