]> spindle.queued.net Git - midori/commitdiff
Don't inject autosuggest bits where we dont need it
authorAlexander Butenko <a.butenka@gmail.com>
Wed, 30 Jun 2010 13:51:54 +0000 (09:51 -0400)
committerChristian Dywan <christian@twotoasts.de>
Wed, 30 Jun 2010 19:09:55 +0000 (21:09 +0200)
data/autosuggestcontrol.js
extensions/formhistory.c

index f045f0f5481daca3d158d528ebf41d61a7670e94..85a506ab6954749e97b1061db3ac2030220b05c2 100644 (file)
@@ -295,7 +295,9 @@ FormSuggestions.prototype.requestSuggestions = function (oAutoSuggestControl /*:
 };
 
 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++)
     {
@@ -308,4 +310,5 @@ function initSuggestions () {
         if (inputs[i].type == "text" && autocomplete != "off")
             var smth = new AutoSuggestControl (inputs[i], new FormSuggestions (ename));
     }
+    return true;
 };
index f0790af855c15359690a2e479983e883604f3cd4..b772ef04bf90c0990abf440b749312abe2dc4cd1 100644 (file)
@@ -64,7 +64,8 @@ formhistory_prepare_js ()
         "function () {"
         "   if (document.getElementById('formhistory'))"
         "       return;"
-        "   initSuggestions ();"
+        "   if (!initSuggestions ())"
+        "       return;"
         "   var mystyle = document.createElement('style');"
         "   mystyle.setAttribute('type', 'text/css');"
         "   mystyle.setAttribute('id', 'formhistory');"