title: Is there any way of setting the buttons attribute of MouseEvent in Mozilla?
body: <p>I'm used to simulating mouse clicks in Javascript like so:</p>
  
  <pre><code>var evt = document.createEvent("MouseEvents");
  evt.initMouseEvent("click", true, true, document.view, 1, 1492, 398, 1308, 274, false, false, false, false, 0, null);
  var element = document.getElementById("x:1430424820.87:chkState:0");
  element.dispatchEvent(evt);
  </code></pre>
  
  <p>While this does dispatch the click event, initMouseEvent() doesn't set the 'buttons' attribute of the MouseEvent interface described in DOM 3:</p>
  
  <pre><code>[Constructor(DOMString typeArg, optional MouseEventInit mouseEventInitDict)]
  interface MouseEvent : UIEvent {
      readonly    attribute long           screenX;
      readonly    attribute long           screenY;
      readonly    attribute long           clientX;
      readonly    attribute long           clientY;
      readonly    attribute boolean        ctrlKey;
      readonly    attribute boolean        shiftKey;
      readonly    attribute boolean        altKey;
      readonly    attribute boolean        metaKey;
      readonly    attribute short          button;
      readonly    attribute EventTarget?   relatedTarget;
      // Introduced in DOM Level 3
      readonly    attribute unsigned short buttons;
      boolean getModifierState (DOMString keyArg);
  };
  </code></pre>
  
  <p>Adding "evt.buttons = 1"...</p>
  
  <pre><code>var evt = document.createEvent("MouseEvents");
  evt.initMouseEvent("click", true, true, document.view, 1, 1492, 398, 1308, 274, false, false, false, false, 0, null);
  evt.buttons = 1;
  var element = document.getElementById("x:1430424820.87:chkState:0");
  element.dispatchEvent(evt);
  </code></pre>
  
  <p>...has no effect. Does anyone know how to do it?</p>