function customClick(element, config, eventName) {
  eventName = eventName || 'click';
  const props = {
    bubbles: true,
    cancelable: true,
    button: 0,
    buttons: 1,
    shiftKey: false,
    ctrlKey: false,
    detail: 1,
  };

  if (config) {
    for (const key in config)
      props[key] = config[key];
  }

  if (cr.isMac && props.ctrlKey) {
    props.ctrlKey = false;
    props.metaKey = true;
  }

  element.dispatchEvent(new MouseEvent('mousedown', props));
  element.dispatchEvent(new MouseEvent('mouseup', props));
  element.dispatchEvent(new MouseEvent(eventName, props));
  if (config && config.detail == 2)
    element.dispatchEvent(new MouseEvent('dblclick', props));
}
/**
 * Sends a custom click event to |element|. All ctrl-clicks are automatically
 * rewritten to command-clicks on Mac.
 * @param {HTMLElement} element
 * @param {Object=} config
 * @param {string=} eventName
 */
Sends a custom click event to |element|. All ctrl-clicks are automatically
rewritten to command-clicks on Mac.
Sends a custom click event to |element| . All ctrl - clicks are automatically rewritten to command - clicks on Mac .
function customClick(element, config, eventName) {
  eventName = eventName || 'click';
  const props = {
    bubbles: true,
    cancelable: true,
    button: 0,
    buttons: 1,
    shiftKey: false,
    ctrlKey: false,
    detail: 1,
  };
  if (config) {
    for (const key in config)
      props[key] = config[key];
  }
  if (cr.isMac && props.ctrlKey) {
    props.ctrlKey = false;
    props.metaKey = true;
  }
  element.dispatchEvent(new MouseEvent('mousedown', props));
  element.dispatchEvent(new MouseEvent('mouseup', props));
  element.dispatchEvent(new MouseEvent(eventName, props));
  if (config && config.detail == 2)
    element.dispatchEvent(new MouseEvent('dblclick', props));
}
function customClick ( element , config , eventName ) { eventName = eventName || 'click' ; const props = { bubbles : true , cancelable : true , button : 0 , buttons : 1 , shiftKey : false , ctrlKey : false , detail : 1 , } ; if ( config ) { for ( const key in config ) props [ key ] = config [ key ] ; } if ( cr . isMac && props . ctrlKey ) { props . ctrlKey = false ; props . metaKey = true ; } element . dispatchEvent ( new MouseEvent ( 'mousedown' , props ) ) ; element . dispatchEvent ( new MouseEvent ( 'mouseup' , props ) ) ; element . dispatchEvent ( new MouseEvent ( eventName , props ) ) ; if ( config && config . detail == 2 ) element . dispatchEvent ( new MouseEvent ( 'dblclick' , props ) ) ; }
Sends a custom click event to |element|.
Sends a custom click event to |element| .