Don't inject autosuggest bits where we dont need it

This commit is contained in:
Alexander Butenko 2010-06-30 09:51:54 -04:00 committed by Christian Dywan
parent d6addb595b
commit 896cc75f57
2 changed files with 6 additions and 2 deletions

View file

@ -295,7 +295,9 @@ FormSuggestions.prototype.requestSuggestions = function (oAutoSuggestControl /*:
}; };
function initSuggestions () { function initSuggestions () {
var inputs = document.getElementsByTagName("input"); var inputs = document.getElementsByTagName ("input");
if (inputs.length == 0)
return false;
for (i=0;i<inputs.length;i++) for (i=0;i<inputs.length;i++)
{ {
@ -308,4 +310,5 @@ function initSuggestions () {
if (inputs[i].type == "text" && autocomplete != "off") if (inputs[i].type == "text" && autocomplete != "off")
var smth = new AutoSuggestControl (inputs[i], new FormSuggestions (ename)); var smth = new AutoSuggestControl (inputs[i], new FormSuggestions (ename));
} }
return true;
}; };

View file

@ -64,7 +64,8 @@ formhistory_prepare_js ()
"function () {" "function () {"
" if (document.getElementById('formhistory'))" " if (document.getElementById('formhistory'))"
" return;" " return;"
" initSuggestions ();" " if (!initSuggestions ())"
" return;"
" var mystyle = document.createElement('style');" " var mystyle = document.createElement('style');"
" mystyle.setAttribute('type', 'text/css');" " mystyle.setAttribute('type', 'text/css');"
" mystyle.setAttribute('id', 'formhistory');" " mystyle.setAttribute('id', 'formhistory');"