ie9-oninput-polyfill
Advanced tools
| (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); |
+1
-1
| 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 |
+1
-4
| { | ||
| "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", |
+19
-2
@@ -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'); | ||
| ``` |
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
1
-50%29
141.67%3202
-5.1%13
-27.78%