Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Autcomplete On - Greasemonkey extension
// ==UserScript==
// @name Autocomplete On
// @namespace http://gist.github.com/gray
// @description Undo the disabling of autocomplete on forms and inputs.
// @include *
// ==/UserScript==
// Note: other solutions on userscripts.org don't properly handle dynamically
// inserted widgets. This solution uses the new MutationObserver DOM API.
function fixAutocomplete (elem) {
var tags = ['form', 'input'];
for (var i = tags.length - 1; i >= 0; i--) {
var elems = elem.getElementsByTagName(tags[i]);
if (! elems) next;
for (var j = elems.length - 1; j >= 0; j--) {
var attr = elems[j].autocomplete;
if (attr && 'off' == attr) {
elems[j].removeAttribute('autocomplete');
}
}
}
}
fixAutocomplete(document);
var observer = new MutationObserver(function(mutations) {
mutations.forEach( function (mutation) {
fixAutocomplete(mutation.target);
});
});
observer.observe(document, {
subtree: true,
childList: true,
attributes: true,
attributeFilter: ['autocomplete']
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.