code: function listenForMouse(element) {
  
    element[mousedownListenerSymbol] = event => {
      if (element[mouseTimeoutSymbol]) {
        clearTimeout(element[mouseTimeoutSymbol]);
      }
      element[lastMouseXSymbol] = event.pageX;
      element[lastMouseYSymbol] = event.pageY;
    };
    window.addEventListener('mousedown', element[mousedownListenerSymbol]);
  
    element[mousemoveListenerSymbol] = event => {
      // Postpone checking the mousemove location to give the mousedown event a
      // chance to fire. The 250 ms delay is just guesswork; a shorter delay
      // doesn't seem to work.
      element[mouseTimeoutSymbol] = setTimeout(() => {
        if (element[lastMouseXSymbol] != null && event.pageX !== element[lastMouseXSymbol] ||
            element[lastMouseYSymbol] != null && event.pageY !== element[lastMouseYSymbol]) {
          // mousemove event was at a location other than the last mousedown,
          // and hence most likely a real mousemove event.
          mouseDetected(element);
        } else {
          element[lastMouseXSymbol] = event.pageX;
          element[lastMouseYSymbol] = event.pageY;
        }
      }, 250);
    };
    window.addEventListener('mousemove', element[mousemoveListenerSymbol]);
  }
docs: We try to detect the presence of a mouse by listening for mousemove events which are *not* the result of a mousedown. On a touch device, a tap on the page will generate a fake mousemove, followed by a mousedown. We don't want to respond to those fake mousemove events. To discriminate between fake and real mousemove events, when we get a mousemove event, we wait for a bit to see if the same location is reported as the location of a subsequent mousedown.