[object PointerEvent]

It’s the stringified form of a DOM PointerEvent — i.e., a pointer input event object (mouse/touch/pen) that got converted to the string “[object PointerEvent]”.

Explanation

  • In JS, when an object is coerced to a string (or implicitly printed in some contexts) it often uses its internal class name, producing strings like “[object Object]” or “[object PointerEvent]”.
  • A PointerEvent is the browser’s event object for pointer input (mouse, touch, pen) and contains properties such as type, clientX, clientY, pointerId, pointerType, pressure, buttons, and isPrimary.

How to inspect the event object (practical tips)

  • Use console logging that shows the object structure:
  • console.log(event) — usually shows an expandable object in devtools.
  • console.dir(event) — shows the object’s properties in a clearer tree.
  • Copy only the fields you care about into a plain object for easier viewing or JSON serialization:
function handler(e) {
  const info = {
    type: e.type,
    clientX: e.clientX,
    clientY: e.clientY,
    pointerId: e.pointerId,
    pointerType: e.pointerType,
    pressure: e.pressure,
    buttons: e.buttons,
    isPrimary: e.isPrimary
  };
  console.log(info);
}
  • If you try JSON.stringify(event) it will usually fail (circular or non-enumerable properties). Use the selective copy above instead.

Example: listening to pointer events

const el = document.querySelector('#myElement');
el.addEventListener('pointerdown', function(e) {
  console.log('Pointer down:', e);      // expandable in devtools
  console.log('Simple info:', {
    type: e.type,
    x: e.clientX,
    y: e.clientY,
    pointerType: e.pointerType
  });
  // optionally capture pointer
  el.setPointerCapture(e.pointerId);
});

Useful PointerEvent properties

  • e.type — event type, e.g. “pointerdown”, “pointermove”
  • e.clientX, e.clientY — coordinates in the viewport
  • e.pointerId — unique id for the pointer
  • e.pointerType — “mouse”, “pen”, or “touch”
  • e.pressure — pressure (0–1) for pen/touch
  • e.buttons — which buttons are pressed
  • e.isPrimary — whether this is the primary pointer

Notes

  • Seeing “[object PointerEvent]” is not an error — it’s just the object’s default string representation.
  • Pointer Events are widely supported in modern browsers; older browsers may need mouse/touch fallbacks.

If you want, paste the code that produced “[object PointerEvent]” and I can show exactly how to log the useful fields or fix any bug.