gator
gator copied to clipboard
Event delegation in Javascript
**Description:** A once event allows firing a listener one time and automatically removes that listener. **Use case** An event handler for a modal background. Before: ```js Gator(document).on('click', '.modal-bg', () =>...
"Apache 2" is not a valid SPDX license identifier
It's common to pre-emptively call `off` with an event and handler prior to any handlers being registered. This is a safeguard to ensure that the same handler isn't attached multiple...
`.off` does not guard against `_handlers[gator.id][event]` being undefined. Thus: https://github.com/ccampbell/gator/blob/master/gator.js#L187 throws a TypeError exception when attempting to access the selector on undefined. ``` Uncaught TypeError: Cannot read property '' of...
Source is a proper CommonJS module. UMD utility generates the wrapping UMD wrapper and is uglified. Both of these steps are done via npm's `prepare` step, which is run automatically...
That is the only thing in the whole file that makes this package not to work in Node.js. If you check if window exists before assigning the variable, we would...
Currently users cannot set a default useCapture. This means we're unable to use custom options like "passive".
It would be nice for the Gator standard library to include sugar for one-time listeners, namely `onFirst` and `onNth`. Here's a sample implementation of onFirst: ``` Gator.prototype.onFirst = function (events,...
This is a simple fix for issue #7. It adds support for change and submit events in legacy ie browsers which don't support event bubbling on them. It uses a...