Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

inputevent

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inputevent

Alleviate browser bugs for input events

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
increased by14.29%
Maintainers
1
Weekly downloads
 
Created
Source

inputevent

Alleviate browser bugs for input events

Travis build status

The 'input' event

The 'input' event is awesome. It's triggerred when an input is modified. At least it's meant to. All browsers currently have some circumstances where they fail to trigger it. See here for a nice summary.

The inputevent library

This library alleviates this by firing the missing 'input' events when needed.

Usage
  • load the library

  • call inputevent.install()

What's pretty cool
Auto detection

Iit correctly detects what needs to be patched for all browsers, including future versions that hopefully will fix their behavior

Instead of targetting particular versions of browser, we listen for the first 'input' or 'change' event triggerred for the problematic types of inputs.

If an 'input' event is received first, all is well. Otherwise, we listen for future 'change' events and trigger a corresponding 'input' event each time.

Short

It's about 50 lines of code.

What's less cool
Event order

In browsers that we "fix", the 'input' event happens after the 'change' event instead of before.

JS events

We make a best effort to distinguish between native events and those triggered by JS code.

We ignore non-native events completely, so if you trigger a 'change' event with JS code for a "fixed" type of input, we won't trigger an 'input' event. Thanks to incomplete support for event.isTrusted in Chrome / Safari / Opera, events that are triggeried via JS and not using jQuery may not be distinguished though.

Similarly, triggering a 'change' or an 'input' event with JS code (not using jQuery and with a browser not supporting isTrusted), before an actual user interaction happens, could fool the detection code into erroneously thinking that the browser needs (or doesn't need) "fixing".

FAQs

Package last updated on 14 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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