detect-autofill
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -0,1 +1,13 @@ | ||
# [1.1.0](https://github.com/matteobad/detect-autofill/compare/v1.0.0...v1.1.0) (2019-07-20) | ||
### Bug Fixes | ||
* greenkeeper conflict ([864e363](https://github.com/matteobad/detect-autofill/commit/864e363)) | ||
### Features | ||
* reduce bundle size with closure compiler ([b530610](https://github.com/matteobad/detect-autofill/commit/b530610)) | ||
# 1.0.0 (2019-07-19) | ||
@@ -2,0 +14,0 @@ |
@@ -1,1 +0,23 @@ | ||
!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";n.r(e);n(1);if(document.addEventListener("animationstart",function(t){"onautofillstart"===t.animationName?r(t.target):o(t.target)},!0),document.addEventListener("input",function(t){"insertReplacementText"!==t.inputType&&"data"in t?o(t.target):r(t.target)},!0),"function"!=typeof window.CustomEvent){window.CustomEvent=function(t,e){e=e||{bubbles:!1,cancelable:!1,detail:null};var n=document.createEvent("CustomEvent");return n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n}}function r(t){if(!t.hasAttribute("autocompleted")){t.setAttribute("autocompleted","");var e=new window.CustomEvent("onautocomplete",{bubbles:!0,cancelable:!0,detail:null});t.dispatchEvent(e)||(t.value="")}}function o(t){t.hasAttribute("autocompleted")&&(t.removeAttribute("autocompleted"),t.dispatchEvent(new window.CustomEvent("onautocomplete",{bubbles:!0,cancelable:!1,detail:null})))}},function(t,e,n){var r=n(2);"string"==typeof r&&(r=[[t.i,r,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n(4)(r,o);r.locals&&(t.exports=r.locals)},function(t,e,n){(t.exports=n(3)(!1)).push([t.i,"INPUT:-webkit-autofill, SELECT:-webkit-autofill, TEXTAREA:-webkit-autofill {\n animation-name: onautofillstart; }\n\nINPUT:not(:-webkit-autofill), SELECT:not(:-webkit-autofill), TEXTAREA:not(:-webkit-autofill) {\n animation-name: onautofillcancel; }\n\n@keyframes onautofillstart {\n from { } }\n\n@keyframes onautofillcancel {\n from { } }\n",""])},function(t,e,n){"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var n=function(t,e){var n=t[1]||"",r=t[3];if(!r)return n;if(e&&"function"==typeof btoa){var o=(a=r,u=btoa(unescape(encodeURIComponent(JSON.stringify(a)))),s="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(u),"/*# ".concat(s," */")),i=r.sources.map(function(t){return"/*# sourceURL=".concat(r.sourceRoot).concat(t," */")});return[n].concat(i).concat([o]).join("\n")}var a,u,s;return[n].join("\n")}(e,t);return e[2]?"@media ".concat(e[2],"{").concat(n,"}"):n}).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var r={},o=0;o<this.length;o++){var i=this[o][0];null!=i&&(r[i]=!0)}for(var a=0;a<t.length;a++){var u=t[a];null!=u[0]&&r[u[0]]||(n&&!u[2]?u[2]=n:n&&(u[2]="(".concat(u[2],") and (").concat(n,")")),e.push(u))}},e}},function(t,e,n){var r,o,i={},a=(r=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===o&&(o=r.apply(this,arguments)),o}),u=function(t){var e={};return function(t,n){if("function"==typeof t)return t();if(void 0===e[t]){var r=function(t,e){return e?e.querySelector(t):document.querySelector(t)}.call(this,t,n);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(t){r=null}e[t]=r}return e[t]}}(),s=null,c=0,l=[],f=n(5);function p(t,e){for(var n=0;n<t.length;n++){var r=t[n],o=i[r.id];if(o){o.refs++;for(var a=0;a<o.parts.length;a++)o.parts[a](r.parts[a]);for(;a<r.parts.length;a++)o.parts.push(y(r.parts[a],e))}else{var u=[];for(a=0;a<r.parts.length;a++)u.push(y(r.parts[a],e));i[r.id]={id:r.id,refs:1,parts:u}}}}function d(t,e){for(var n=[],r={},o=0;o<t.length;o++){var i=t[o],a=e.base?i[0]+e.base:i[0],u={css:i[1],media:i[2],sourceMap:i[3]};r[a]?r[a].parts.push(u):n.push(r[a]={id:a,parts:[u]})}return n}function v(t,e){var n=u(t.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var r=l[l.length-1];if("top"===t.insertAt)r?r.nextSibling?n.insertBefore(e,r.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),l.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var o=u(t.insertAt.before,n);n.insertBefore(e,o)}}function b(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=l.indexOf(t);e>=0&&l.splice(e,1)}function m(t){var e=document.createElement("style");if(void 0===t.attrs.type&&(t.attrs.type="text/css"),void 0===t.attrs.nonce){var r=function(){0;return n.nc}();r&&(t.attrs.nonce=r)}return h(e,t.attrs),v(t,e),e}function h(t,e){Object.keys(e).forEach(function(n){t.setAttribute(n,e[n])})}function y(t,e){var n,r,o,i;if(e.transform&&t.css){if(!(i="function"==typeof e.transform?e.transform(t.css):e.transform.default(t.css)))return function(){};t.css=i}if(e.singleton){var a=c++;n=s||(s=m(e)),r=E.bind(null,n,a,!1),o=E.bind(null,n,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",h(e,t.attrs),v(t,e),e}(e),r=function(t,e,n){var r=n.css,o=n.sourceMap,i=void 0===e.convertToAbsoluteUrls&&o;(e.convertToAbsoluteUrls||i)&&(r=f(r));o&&(r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var a=new Blob([r],{type:"text/css"}),u=t.href;t.href=URL.createObjectURL(a),u&&URL.revokeObjectURL(u)}.bind(null,n,e),o=function(){b(n),n.href&&URL.revokeObjectURL(n.href)}):(n=m(e),r=function(t,e){var n=e.css,r=e.media;r&&t.setAttribute("media",r);if(t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}.bind(null,n),o=function(){b(n)});return r(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;r(t=e)}else o()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=a()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=d(t,e);return p(n,e),function(t){for(var r=[],o=0;o<n.length;o++){var a=n[o];(u=i[a.id]).refs--,r.push(u)}t&&p(d(t,e),e);for(o=0;o<r.length;o++){var u;if(0===(u=r[o]).refs){for(var s=0;s<u.parts.length;s++)u.parts[s]();delete i[u.id]}}}};var w,g=(w=[],function(t,e){return w[t]=e,w.filter(Boolean).join("\n")});function E(t,e,n,r){var o=n?"":r.css;if(t.styleSheet)t.styleSheet.cssText=g(e,o);else{var i=document.createTextNode(o),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(i,a[e]):t.appendChild(i)}}},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,r=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(t,e){var o,i=e.trim().replace(/^"(.*)"$/,function(t,e){return e}).replace(/^'(.*)'$/,function(t,e){return e});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(i)?t:(o=0===i.indexOf("//")?i:0===i.indexOf("/")?n+i:r+i.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")})}}]); | ||
(function(){'use strict';var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}};$jscomp.arrayIterator=function(a){return{next:$jscomp.arrayIteratorImpl(a)}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1; | ||
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_";$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)}; | ||
$jscomp.SymbolClass=function(a,b){this.$jscomp$symbol$id_=a;$jscomp.defineProperty(this,"description",{configurable:!0,writable:!0,value:b})};$jscomp.SymbolClass.prototype.toString=function(){return this.$jscomp$symbol$id_};$jscomp.Symbol=function(){function a(c){if(this instanceof a)throw new TypeError("Symbol is not a constructor");return new $jscomp.SymbolClass($jscomp.SYMBOL_PREFIX+(c||"")+"_"+b++,c)}var b=0;return a}(); | ||
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var a=$jscomp.global.Symbol.iterator;a||(a=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("Symbol.iterator"));"function"!=typeof Array.prototype[a]&&$jscomp.defineProperty(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return $jscomp.iteratorPrototype($jscomp.arrayIteratorImpl(this))}});$jscomp.initSymbolIterator=function(){}}; | ||
$jscomp.initSymbolAsyncIterator=function(){$jscomp.initSymbol();var a=$jscomp.global.Symbol.asyncIterator;a||(a=$jscomp.global.Symbol.asyncIterator=$jscomp.global.Symbol("Symbol.asyncIterator"));$jscomp.initSymbolAsyncIterator=function(){}};$jscomp.iteratorPrototype=function(a){$jscomp.initSymbolIterator();a={next:a};a[$jscomp.global.Symbol.iterator]=function(){return this};return a}; | ||
$jscomp.iteratorFromArray=function(a,b){$jscomp.initSymbolIterator();a instanceof String&&(a+="");var c=0,d={next:function(){if(c<a.length){var e=c++;return{value:b(e,a[e]),done:!1}}d.next=function(){return{done:!0,value:void 0}};return d.next()}};d[Symbol.iterator]=function(){return d};return d}; | ||
$jscomp.polyfill=function(a,b,c,d){if(b){c=$jscomp.global;a=a.split(".");for(d=0;d<a.length-1;d++){var e=a[d];e in c||(c[e]={});c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:b})}};$jscomp.polyfill("Array.prototype.keys",function(a){return a?a:function(){return $jscomp.iteratorFromArray(this,function(a){return a})}},"es6","es3"); | ||
(function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={i:d,l:!1,exports:{}};a[d].call(e.exports,e,e.exports,b);e.l=!0;return e.exports}var c={};b.m=a;b.c=c;b.d=function(a,c,k){b.o(a,c)||Object.defineProperty(a,c,{enumerable:!0,get:k})};b.r=function(a){$jscomp.initSymbol();$jscomp.initSymbol();"undefined"!==typeof Symbol&&Symbol.toStringTag&&($jscomp.initSymbol(),Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}));Object.defineProperty(a,"__esModule",{value:!0})};b.t=function(a, | ||
c){c&1&&(a=b(a));if(c&8||c&4&&"object"===typeof a&&a&&a.__esModule)return a;var k=Object.create(null);b.r(k);Object.defineProperty(k,"default",{enumerable:!0,value:a});if(c&2&&"string"!=typeof a)for(var d in a)b.d(k,d,function(b){return a[b]}.bind(null,d));return k};b.n=function(a){var c=a&&a.__esModule?function(){return a["default"]}:function(){return a};b.d(c,"a",c);return c};b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)};b.p="";return b(b.s=0)})([function(a,b,c){function d(a){if(!a.hasAttribute("autocompleted")){a.setAttribute("autocompleted", | ||
"");var b=new window.CustomEvent("onautocomplete",{bubbles:!0,cancelable:!0,detail:null});a.dispatchEvent(b)||(a.value="")}}function e(a){a.hasAttribute("autocompleted")&&(a.removeAttribute("autocompleted"),a.dispatchEvent(new window.CustomEvent("onautocomplete",{bubbles:!0,cancelable:!1,detail:null})))}c.r(b);a=c(1);c.n(a);document.addEventListener("animationstart",function(a){"onautofillstart"===a.animationName?d(a.target):e(a.target)},!0);document.addEventListener("input",function(a){"insertReplacementText"!== | ||
a.inputType&&"data"in a?e(a.target):d(a.target)},!0);"function"!==typeof window.CustomEvent&&(window.CustomEvent=function(a,b){b=b||{bubbles:!1,cancelable:!1,detail:null};var c=document.createEvent("CustomEvent");c.initCustomEvent(a,b.bubbles,b.cancelable,b.detail);return c})},function(a,b,c){b=c(2);"string"===typeof b&&(b=[[a.i,b,""]]);c(4)(b,{hmr:!0,transform:void 0,insertInto:void 0});b.locals&&(a.exports=b.locals)},function(a,b,c){b=a.exports=c(3)(!1);b.push([a.i,"INPUT:-webkit-autofill, SELECT:-webkit-autofill, TEXTAREA:-webkit-autofill {\n animation-name: onautofillstart; }\n\nINPUT:not(:-webkit-autofill), SELECT:not(:-webkit-autofill), TEXTAREA:not(:-webkit-autofill) {\n animation-name: onautofillcancel; }\n\n@keyframes onautofillstart {\n from { } }\n\n@keyframes onautofillcancel {\n from { } }\n", | ||
""])},function(a,b,c){function d(a,b){var c=a[1]||"",d=a[3];return d?b&&"function"===typeof btoa?(a=e(d),b=d.sources.map(function(a){return"/*# sourceURL=".concat(d.sourceRoot).concat(a," */")}),[c].concat(b).concat([a]).join("\n")):[c].join("\n"):c}function e(a){a=btoa(unescape(encodeURIComponent(JSON.stringify(a))));a="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(a);return"/*# ".concat(a," */")}a.exports=function(a){var b=[];b.toString=function(){return this.map(function(b){var c= | ||
d(b,a);return b[2]?"@media ".concat(b[2],"{").concat(c,"}"):c}).join("")};b.i=function(a,c){"string"===typeof a&&(a=[[null,a,""]]);for(var d={},e=0;e<this.length;e++){var h=this[e][0];null!=h&&(d[h]=!0)}for(e=0;e<a.length;e++)h=a[e],null!=h[0]&&d[h[0]]||(c&&!h[2]?h[2]=c:c&&(h[2]="(".concat(h[2],") and (").concat(c,")")),b.push(h))};return b}},function(a,b,c){function d(a,b){for(var f=0;f<a.length;f++){var g=a[f],c=m[g.id];if(c){c.refs++;for(var d=0;d<c.parts.length;d++)c.parts[d](g.parts[d]);for(;d< | ||
g.parts.length;d++)c.parts.push(r(g.parts[d],b))}else{c=[];for(d=0;d<g.parts.length;d++)c.push(r(g.parts[d],b));m[g.id]={id:g.id,refs:1,parts:c}}}}function e(a,b){for(var g=[],c={},f=0;f<a.length;f++){var d=a[f],e=b.base?d[0]+b.base:d[0];d={css:d[1],media:d[2],sourceMap:d[3]};c[e]?c[e].parts.push(d):g.push(c[e]={id:e,parts:[d]})}return g}function k(a,b){var c=t(a.insertInto);if(!c)throw Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid."); | ||
var g=l[l.length-1];if("top"===a.insertAt)g?g.nextSibling?c.insertBefore(b,g.nextSibling):c.appendChild(b):c.insertBefore(b,c.firstChild),l.push(b);else if("bottom"===a.insertAt)c.appendChild(b);else if("object"===typeof a.insertAt&&a.insertAt.before)a=t(a.insertAt.before,c),c.insertBefore(b,a);else throw Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n"); | ||
}function n(a){if(null===a.parentNode)return!1;a.parentNode.removeChild(a);a=l.indexOf(a);0<=a&&l.splice(a,1)}function p(a){var b=document.createElement("style");void 0===a.attrs.type&&(a.attrs.type="text/css");if(void 0===a.attrs.nonce){var d;if(d=c.nc)a.attrs.nonce=d}q(b,a.attrs);k(a,b);return b}function v(a){var b=document.createElement("link");void 0===a.attrs.type&&(a.attrs.type="text/css");a.attrs.rel="stylesheet";q(b,a.attrs);k(a,b);return b}function q(a,b){Object.keys(b).forEach(function(c){a.setAttribute(c, | ||
b[c])})}function r(a,b){var c;if(b.transform&&a.css)if(c="function"===typeof b.transform?b.transform(a.css):b.transform.default(a.css))a.css=c;else return function(){};if(b.singleton){c=w++;var d=u||(u=p(b));var f=h.bind(null,d,c,!1);var g=h.bind(null,d,c,!0)}else a.sourceMap&&"function"===typeof URL&&"function"===typeof URL.createObjectURL&&"function"===typeof URL.revokeObjectURL&&"function"===typeof Blob&&"function"===typeof btoa?(d=v(b),f=x.bind(null,d,b),g=function(){n(d);d.href&&URL.revokeObjectURL(d.href)}): | ||
(d=p(b),f=y.bind(null,d),g=function(){n(d)});f(a);return function(b){b?(b.css!==a.css||b.media!==a.media||b.sourceMap!==a.sourceMap)&&f(a=b):g()}}function h(a,b,c,d){c=c?"":d.css;a.styleSheet?a.styleSheet.cssText=z(b,c):(c=document.createTextNode(c),d=a.childNodes,d[b]&&a.removeChild(d[b]),d.length?a.insertBefore(c,d[b]):a.appendChild(c))}function y(a,b){var c=b.css;(b=b.media)&&a.setAttribute("media",b);if(a.styleSheet)a.styleSheet.cssText=c;else{for(;a.firstChild;)a.removeChild(a.firstChild);a.appendChild(document.createTextNode(c))}} | ||
function x(a,b,c){var d=c.css;c=c.sourceMap;var f=void 0===b.convertToAbsoluteUrls&&c;if(b.convertToAbsoluteUrls||f)d=A(d);c&&(d+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(c))))+" */");b=new Blob([d],{type:"text/css"});d=a.href;a.href=URL.createObjectURL(b);d&&URL.revokeObjectURL(d)}var m={},B=function(a){var b;return function(){"undefined"===typeof b&&(b=a.apply(this,arguments));return b}}(function(){return window&&document&&document.all&& | ||
!window.atob}),t=function(a){var b={};return function(a,c){if("function"===typeof a)return a();if("undefined"===typeof b[a]){c=c?c.querySelector(a):document.querySelector(a);if(window.HTMLIFrameElement&&c instanceof window.HTMLIFrameElement)try{c=c.contentDocument.head}catch(C){c=null}b[a]=c}return b[a]}}(),u=null,w=0,l=[],A=c(5);a.exports=function(a,b){if("undefined"!==typeof DEBUG&&DEBUG&&"object"!==typeof document)throw Error("The style-loader cannot be used in a non-browser environment");b=b|| | ||
{};b.attrs="object"===typeof b.attrs?b.attrs:{};b.singleton||"boolean"===typeof b.singleton||(b.singleton=B());b.insertInto||(b.insertInto="head");b.insertAt||(b.insertAt="bottom");var c=e(a,b);d(c,b);return function(a){for(var g=[],f=0;f<c.length;f++){var h=m[c[f].id];h.refs--;g.push(h)}a&&(f=e(a,b),d(f,b));for(f=0;f<g.length;f++)if(h=g[f],0===h.refs){for(a=0;a<h.parts.length;a++)h.parts[a]();delete m[h.id]}}};var z=function(){var a=[];return function(b,c){a[b]=c;return a.filter(Boolean).join("\n")}}()}, | ||
function(a,b){a.exports=function(a){var b="undefined"!==typeof window&&window.location;if(!b)throw Error("fixUrls requires window.location");if(!a||"string"!==typeof a)return a;var c=b.protocol+"//"+b.host,k=c+b.pathname.replace(/\/[^\/]*$/,"/");return a.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(a,b){b=b.trim().replace(/^"(.*)"$/,function(a,b){return b}).replace(/^'(.*)'$/,function(a,b){return b});if(/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(b))return a; | ||
a=0===b.indexOf("//")?b:0===b.indexOf("/")?c+b:k+b.replace(/^\.\//,"");return"url("+JSON.stringify(a)+")"})}}]);}).call(this || window) |
{ | ||
"name": "detect-autofill", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Small javascript library to detect and even prevent browsers autofill of form elements. Usefull for implementing floating labels or applying custom logics/styles.", | ||
@@ -26,4 +26,3 @@ "main": "dist/detect-autofill.js", | ||
"-webkit-autofill", | ||
"floating", | ||
"label", | ||
"floating-label", | ||
"vanilla" | ||
@@ -45,7 +44,11 @@ ], | ||
"@semantic-release/release-notes-generator": "^7.2.1", | ||
"commitizen": "^4.0.1", | ||
"bundlesize": "^0.18.0", | ||
"clean-webpack-plugin": "^3.0.0", | ||
"closure-webpack-plugin": "^2.0.1", | ||
"commitizen": "^4.0.3", | ||
"css-loader": "^3.1.0", | ||
"cz-conventional-changelog": "^2.1.0", | ||
"cz-conventional-changelog": "^3.0.1", | ||
"eslint": "^6.0.1", | ||
"eslint-config-google": "^0.13.0", | ||
"google-closure-compiler": "^20190709.0.0", | ||
"husky": "^3.0.1", | ||
@@ -69,3 +72,9 @@ "node-sass": "^4.12.0", | ||
} | ||
} | ||
}, | ||
"bundlesize": [ | ||
{ | ||
"path": "./dist/*.js", | ||
"maxSize": "5 kB" | ||
} | ||
] | ||
} |
@@ -1,2 +0,69 @@ | ||
# detect-autofill | ||
# Detect browsers autofill | ||
[![npm version](https://badge.fury.io/js/detect-autofill.svg)](https://badge.fury.io/js/detect-autofill) [![Build Status](https://travis-ci.org/matteobad/detect-autofill.svg?branch=master)](https://travis-ci.org/matteobad/detect-autofill/) ![David](https://img.shields.io/david/dev/matteobad/detect-autofill.svg) ![David](https://img.shields.io/david/matteobad/detect-autofill.svg) [![Greenkeeper badge](https://badges.greenkeeper.io/matteobad/detect-autofill.svg)](https://greenkeeper.io/) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) | ||
* [Getting started](#getting-started) | ||
* [Features](#features) | ||
* [Browser support](#browser-support) | ||
* [Demo](https://matteobad.github.io/focus-within-polyfill) | ||
## TLDR | ||
1. Import script in the head | ||
```html | ||
<head> | ||
... | ||
<script src="https://unpkg.com/detect-autofill/dist/detect-autofill.js"></script> | ||
... | ||
</head> | ||
``` | ||
2. add event listeners | ||
3. do your things... | ||
```js | ||
document.addEventListener('autocomplete', function(e) { | ||
e.target.hasAttribute('autocompleted'); // true or false | ||
e.preventDefault(); // prevent autofill | ||
// do you stuff... | ||
}) | ||
``` | ||
## Getting Started | ||
Small javascript library to detect browser autofill of form elements. Usefull for implementing floating labels or appling custom styles. | ||
Modern browsers all have some ability to autocomplete the forms in a web page. It can be a login or a registration form, and the autofill can be triggered automatiaclly by the browser or manually by the user. In both cases **there is no native way to detect the autocomplete**. This is where this small library comes in handy. | ||
Every browser has it's own way to autocomplete a form. Basically this library creates and triggers a `CustomEvent` called `autocomplete` every time this happends. | ||
Furthermore this custom event can be prevented like all native events in order to block browser autofill using `e.preventDefault()`. | ||
## Features | ||
* Polyfill for CustomEvent integrated | ||
* CustomEvent on autocomplete | ||
* CustomEvent on autocomplete cancel | ||
* Possibility to prevent autocomplete | ||
## Browser Support | ||
| CustomEvent | Edge | IE11 | Chrome | Firefox | Safari | Opera | iOS | | ||
| -------------- |:----:|:-----:|:------:|:-------:|:------:|:-----:|:---:| | ||
| `autocomplete` | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ||
\* This script uses different technics to detect autofill based on the browser: | ||
* **Chrome**, **Opera** and **Safari** uses the pseudo-class `:-webkit-autofill` to trigger a custom animation. | ||
* **Firefox** uses input event on document and checks for a propriety `inputType` property of the event. | ||
* **IE**, **Edge** and **iOS** uses the same input event but they have to check the `data` property. | ||
* **Android** ha not yet been tested but I have reason to believe it works just fine. | ||
## Demos | ||
The [demos](https://github.com/matteobad/detect-autofill/tree/master/demos) can be tested on every browser. If something is not working properly, please open an issue or a PR. | ||
| Title | Source code | Live demo | | ||
| ----- | ----------- | --------- | | ||
| Fake login page | [Code](demos/fake-login.html) | [Live](https://matteobad.github.io/detect-autofill/demos/fake-login.html) | |
25664
14
70
70
23