🔰"dblclick"

browsereventtypemouse ⟩ "dblclick"

If two clicks happen close together, a "dblclick" (double-click) event also fires, after the second "click" event, that is:

  • mousedown -> mouseup -> click ->

  • mousedown -> mouseup -> click ->

  • dblclick

// general handler
const logTarget = (event, type) => {
    const len = 'mousedown'.length;
    const t = event.target;
    log(`🔘 ${type.padEnd(len, ' ')}: <${t.nodeName}> ${t.id ? '#' + t.id : ''}`);
};

// register handlers for mouse events
['mousedown', 'mouseup', 'click', 'dblclick'].forEach(type => {
    window['on' + type] = e => logTarget(e, type);
})

Last updated