[Xfce4-commits] <midori:master> Don't inject autosuggest bits where we dont need it

Christian Dywan noreply at xfce.org
Wed Jun 30 21:10:01 CEST 2010


Updating branch refs/heads/master
         to 896cc75f5771693f9f39fdffdcf37b518abd01a6 (commit)
       from d6addb595ba8218e5b0f83cb9b4f32fa50bd5f2b (commit)

commit 896cc75f5771693f9f39fdffdcf37b518abd01a6
Author: Alexander Butenko <a.butenka at gmail.com>
Date:   Wed Jun 30 09:51:54 2010 -0400

    Don't inject autosuggest bits where we dont need it

 data/autosuggestcontrol.js |    5 ++++-
 extensions/formhistory.c   |    3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/data/autosuggestcontrol.js b/data/autosuggestcontrol.js
index f045f0f..85a506a 100644
--- a/data/autosuggestcontrol.js
+++ b/data/autosuggestcontrol.js
@@ -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;
 };
diff --git a/extensions/formhistory.c b/extensions/formhistory.c
index f0790af..b772ef0 100644
--- a/extensions/formhistory.c
+++ b/extensions/formhistory.c
@@ -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');"



More information about the Xfce4-commits mailing list