Socket
Socket
Sign inDemoInstall

react-onclickoutside

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-onclickoutside - npm Package Compare versions

Comparing version 5.1.1 to 5.2.0

15

index.js

@@ -11,2 +11,3 @@ /**

var IGNORE_CLASS = 'ignore-react-onclickoutside';
var DEFAULT_EVENTS = ['mousedown', 'touchstart'];

@@ -158,4 +159,7 @@ /**

if (typeof document !== "undefined") {
document.addEventListener("mousedown", fn);
document.addEventListener("touchstart", fn);
var events = this.props.eventTypes || DEFAULT_EVENTS;
if (!events.forEach) { events = [events] };
events.forEach(function (eventName) {
document.addEventListener(eventName, fn);
});
}

@@ -171,4 +175,7 @@ },

if (typeof document !== "undefined") {
document.removeEventListener("mousedown", fn);
document.removeEventListener("touchstart", fn);
var events = this.props.eventTypes || DEFAULT_EVENTS;
if (!events.forEach) { events = [events] };
events.forEach(function (eventName) {
document.removeEventListener(eventName, fn);
});
}

@@ -175,0 +182,0 @@ },

{
"name": "react-onclickoutside",
"version": "5.1.1",
"version": "5.2.0",
"description": "An onClickOutside mixin for React components",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -34,2 +34,16 @@ # An onClickOutside wrapper for React components

## Regulate which events to listen for
By default, "outside clicks" are based on both `mousedown` and `touchstart` events; if that is what you need, then you do not need to specify anything special. However, if you need different events, you can specify these using the `eventTypes` property. If you just need one event, you can pass in the event name as plain string:
```
<MyComponent eventTypes="click" ... />
```
For multiple events, you can pass in the array of event names you need to listen for:
```
<MyComponent eventTypes={["click", "touchend"]} ... />
```
## Regulate whether or not to listen for outside clicks

@@ -126,7 +140,6 @@

This is true, but also an edge-case problem that needs to be fixed in IE, not by thousands of individual libraries that assume browsers have proper HTML API implementations. If you need this to work, you have two options (and you should exercise both):
This is true, but also an edge-case problem that only exists for older versions of IE (including IE11), and should be addressed by you, rather than by thousands of individual libraries that assume browsers have proper HTML API implementations (IE Edge has proper `classList` support even for SVG).
1. I fully expect you to have already filed this as a feature request for the upcoming version of IE (or if it already exists, I expect you to have voted on it), and
2. you can add a shim for `classList` to your page(s), loaded before you load your React code, and you'll have instantly fixed *every* library that you might remotely rely on that makes use of the `classList` property. You can find several shims quite easily, the usualy "first try" shim is the one given over on https://developer.mozilla.org/en/docs/Web/API/Element/classList
If you need this to work, you can add a shim for `classList` to your page(s), loaded before you load your React code, and you'll have instantly fixed *every* library that you might remotely rely on that makes use of the `classList` property. You can find several shims quite easily, the usualy "first try" shim is the one given over on https://developer.mozilla.org/en/docs/Web/API/Element/classList
Eventually this program will stop being one, but in the mean time *you* responsible for helping the entire world fix this problem in the only place it *should* be fixed: IE. As such, **if you file a PR to fix classList-and-SVG issues specifically for this library, your PR will be clossed and I will politely point you to this README.md section**. I will not accept PRs to fix this issue. You already have the power to fix it, and I expect you to take responsibility as a fellow developer to let Microsoft know you need them to implement this.
Eventually this problem will stop being one, but in the mean time *you* are responsible for making *your* site work by shimming everything that needs shimming for IE. As such, **if you file a PR to fix classList-and-SVG issues specifically for this library, your PR will be clossed and I will politely point you to this README.md section**. I will not accept PRs to fix this issue. You already have the power to fix it, and I expect you to take responsibility as a fellow developer to let Microsoft know you need them to implement this.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc