1(function () { 2 'use strict'; 3 4 var PASSWORD_SELECTOR = 'input[type="password"], input[name="password"], input[name="confirm_password"], input[name="new_password"]'; 5 6 function disablePasswordAutocomplete(input) { 7 if (!input || input.nodeName !== 'INPUT') { 8 return; 9 } 10 input.setAttribute('autocomplete', 'off'); 11 input.setAttribute('autocorrect', 'off'); 12 input.setAttribute('autocapitalize', 'off'); 13 input.setAttribute('spellcheck', 'false'); 14 } 15 16 function applyToRoot(root) { 17 var scope = root || document; 18 if (!scope.querySelectorAll) { 19 return; 20 } 21 var inputs = scope.querySelectorAll(PASSWORD_SELECTOR); 22 for (var i = 0; i < inputs.length; i++) { 23 disablePasswordAutocomplete(inputs[i]); 24 } 25 } 26 27 function onReady() { 28 applyToRoot(document); 29 30 if (typeof MutationObserver === 'undefined' || !document.body) { 31 return; 32 } 33 34 new MutationObserver(function (mutations) { 35 for (var i = 0; i < mutations.length; i++) { 36 var nodes = mutations[i].addedNodes; 37 for (var j = 0; j < nodes.length; j++) { 38 var node = nodes[j]; 39 if (node.nodeType !== 1) { 40 continue; 41 } 42 if (node.matches && node.matches(PASSWORD_SELECTOR)) { 43 disablePasswordAutocomplete(node); 44 } 45 applyToRoot(node); 46 } 47 } 48 }).observe(document.body, { childList: true, subtree: true }); 49 } 50 51 if (document.readyState === 'loading') { 52 document.addEventListener('DOMContentLoaded', onReady); 53 } else { 54 onReady(); 55 } 56 57 document.addEventListener('focus', function (e) { 58 var target = e.target; 59 if (!target || target.nodeName !== 'INPUT') { 60 return; 61 } 62 if (target.type === 'password' || target.name === 'password' || target.name === 'confirm_password' || target.name === 'new_password') { 63 disablePasswordAutocomplete(target); 64 } 65 }, true); 66})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.