ie9-oninput-polyfill
Advanced tools
Comparing version 1.1.0 to 1.1.1
(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); |
{ | ||
"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'); | ||
``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
0
29
3202
13