title: Javascript getter - why does it get called at construction?
body: <p>I'm new to Javascript getters/setters, but thought to use them in my Leaflet- and browserify-based project. Got a surprise.</p>
  
  <p>The getter gets called at initialization, for some reason unknown to me, before the class's own <code>initialize</code> method (Leaflet construction callback) gets to run. This of course means members are undefined and all breaks up. Why is this?</p>
  
  <ul>
  <li>is this general behaviour with JavaScript getters?</li>
  <li>is this induced by Leaflet (maybe a bug in it)?</li>
  </ul>
  
  <p>Unfortunately, I haven't got a jsfiddle to showcase this - it may be due to Leaflet, or due to node.js like modular build (via browserify) that I do.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>/*
   * Temp.js
   */
  "use strict";
  
  module.exports = L.Class.extend( {
  
    initialize: function () {
      console.log("initialized");
    },
  
    // --- Public methods ---
  
    get some () {
      console.log("getter");
      return 42;
    },
  
    set some (v) {
      console.log("setter: "+v);
    }
  
  });
  </code></pre>
  
  <p>Calling code:</p>
  
  <pre><code>// this just for experiments
  //
  var Temp = require('./src/Temp.js');
  var xxx = new Temp();
  </code></pre>
  
  <p>Produces the output:</p>
  
  <pre><code>[Log] getter (out.js, line 2102)
  [Log] initialized (out.js, line 2096)
  </code></pre>
  
  <p>So: what might call the <code>get</code>?</p>
  
  <p>Using: Safari 8.0.6 (OS X), Leaflet current <code>master</code>, Browserify 10.1.0</p>
  
  <p><em>Addendum</em>:</p>
  
  <p>Debugging, the line that calls the getter is <a href="https://github.com/Leaflet/Leaflet/blob/master/src/core/Util.js#L20" rel="nofollow">this one</a> in Leaflet.</p>