Launch Week Day 5: Introducing Reachability for PHP.Learn More
Socket
Book a DemoSign in
Socket

ie9-oninput-polyfill

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ie9-oninput-polyfill - npm Package Compare versions

Comparing version
1.1.0
to
1.1.1
+5
-10
ie9-oninput-polyfill.js
(function (d) {
if (navigator.userAgent.indexOf('MSIE 9') === -1) return;
var elements = [], values = [];
d.addEventListener('selectionchange', function() {
var actEl = d.activeElement;
var el = d.activeElement;
if (actEl.tagName === 'TEXTAREA' || (actEl.tagName === 'INPUT' && actEl.type === 'text')) {
var idx = elements.indexOf(actEl), el = elements[idx] || elements.push(actEl);
if (el.value !== values[idx]) {
values[idx] = el.value;
var ev = d.createEvent('CustomEvent');
ev.initCustomEvent('input', true, true, {});
el.dispatchEvent(ev);
}
if (el.tagName === 'TEXTAREA' || (el.tagName === 'INPUT' && el.type === 'text')) {
var ev = d.createEvent('CustomEvent');
ev.initCustomEvent('input', true, true, {});
el.dispatchEvent(ev);
}
});
})(document);

@@ -1,1 +0,1 @@

(function(n){if(navigator.userAgent.indexOf("MSIE 9")!==-1){var t=[],i=[];n.addEventListener("selectionchange",function(){var u=n.activeElement,f,e;(u.tagName==="TEXTAREA"||u.tagName==="INPUT"&&u.type==="text")&&(f=t.indexOf(u),e=t[f]||t.push(u),e.value!==i[f]&&(i[f]=e.value,r=n.createEvent("CustomEvent"),r.initCustomEvent("input",!0,!0,{}),e.dispatchEvent(r)))})}})(document);
!function(a){navigator.userAgent.indexOf("MSIE 9")!==-1&&a.addEventListener("selectionchange",function(){var b=a.activeElement;if("TEXTAREA"===b.tagName||"INPUT"===b.tagName&&"text"===b.type){var c=a.createEvent("CustomEvent");c.initCustomEvent("input",!0,!0,{}),b.dispatchEvent(c)}})}(document);
The MIT License (MIT)
Copyright (c) 2015 Vitor Buzinaro
Copyright (c) 2015-2017 Vitor Buzinaro

@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy

{
"name": "ie9-oninput-polyfill",
"version": "1.1.0",
"version": "1.1.1",
"description": "Forces IE9 to trigger the INPUT event when the user deletes/cuts text from the input - making the event works as it should (and as it does in all the modern browsers)",
"main": "ie9-oninput-polyfill.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {

@@ -10,0 +7,0 @@ "type": "git",

@@ -7,6 +7,23 @@ # IE9 oninput (input event) polyfill

`<script src="ie9-oninput-polyfill.js"></script>`
```html
<script src="ie9-oninput-polyfill.js"></script>
```
You can even use the conditional tags:
`<!--[if IE 9]><script src="ie9-oninput-polyfill.js"></script><![endif]-->`
```html
<!--[if IE 9]><script src="ie9-oninput-polyfill.js"></script><![endif]-->
```
## NPM
You can install it from NPM also:
```shell
npm install --save ie9-oninput-polyfill
```
Then, if using some bundler like webpack/browserify, you only need to import it:
```javascript
require('ie9-oninput-polyfill');
```