/prevent-default

Cross browser prevent default, because microsoft is awesome.

Primary LanguageJavaScriptMIT LicenseMIT

prevent

Note
Segment has paused maintenance on this project, but may return it to an active status in the future. Issues and pull requests from external contributors are not being considered, although internal contributions may appear from time to time. The project remains available under its open source license for anyone to use.

CircleCI Codecov

Cross-browser preventDefault

Installation

$ npm install @segment/prevent-default

Example

anchor.onclick = require('prevent');
anchor.onclick = function(e){
  if (something) return require('prevent')(e);
};

API

prevent(e)

Prevent the given e, if the argument is omitted, the method will fallback to window.event.