[X]

captureEvents and the Bitmask

browser wars 1997 dead

In Netscape 4 events were a subscription service: no captureEvents call with the right bitmask, no mousemove for you.

In 2026: Dead as a mechanism, undead as a stub. The rival IE model needed no registration at all and the DOM standard followed suit, but the stub refused to die: the HTML standard now requires document.captureEvents to exist and do nothing, purely so scripts like this cannot throw. The demo finds it alive and useless. Every old mouse trail script starts with this incantation, which is why so many of them begin with if (document.layers).

Where it came from: Netscape Navigator 4 event model, JavaScript 1.2, 1997.
MDN HTML standard

<script language="JavaScript">
// Netscape 4: a page had to ASK to see events, with a bitmask,
// before any of its handlers would fire.
if (document.captureEvents) {
  document.captureEvents(Event.MOUSEMOVE | Event.CLICK);
}
document.onmousemove = function (e) {
  window.status = "Mouse at " + e.pageX + "," + e.pageY;
};
document.write(document.captureEvents
  ? "<p>captureEvents still exists, and the spec requires it to do nothing.</p>"
  : "<p>captureEvents is gone. Handlers just work now.</p>");
</script>
sandboxed demo · breaks nothing but itselfrestart

More in browser wars

view the whole library ›