couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cml...@apache.org
Subject svn commit: r736399 - /couchdb/trunk/share/www/script/jquery.suggest.js
Date Wed, 21 Jan 2009 20:10:04 GMT
Author: cmlenz
Date: Wed Jan 21 12:10:04 2009
New Revision: 736399

URL: http://svn.apache.org/viewvc?rev=736399&view=rev
Log:
The Futon autocomplete dropdown should reposition every time its shown, not only when its
first created.

Modified:
    couchdb/trunk/share/www/script/jquery.suggest.js

Modified: couchdb/trunk/share/www/script/jquery.suggest.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/jquery.suggest.js?rev=736399&r1=736398&r2=736399&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/jquery.suggest.js [utf-8] (original)
+++ couchdb/trunk/share/www/script/jquery.suggest.js [utf-8] Wed Jan 21 12:10:04 2009
@@ -19,13 +19,8 @@
     var cacheKeys = [];
 
     var input = $(elem).attr("autocomplete", "off");
-    var pos = input.position();
     var dropdown = $('<ul style="display: none; position: absolute; z-index: 10000"></ul>')
-      .addClass(options.dropdownClass).insertAfter(input).css({
-        top: (pos.top + input.outerHeight()) + "px",
-        left: pos.left + "px",
-        minWidth: input.css("width")
-      });
+      .addClass(options.dropdownClass).insertAfter(input);
 
     input
       .blur(function() {
@@ -91,8 +86,12 @@
     function show(items, render) {
       if (!items) return;
       if (!items.length) { dropdown.hide(); return; }
+      var pos = input.position();
+      dropdown.empty().css({
+        top: (pos.top + input.outerHeight()) + "px", left: pos.left + "px",
+        minWidth: input.css("width")
+      });
       render = render || function(idx, value) { return value; }
-      dropdown.empty();
       for (var i = 0; i < items.length; i++) {
         var item = $("<li></li>").data("value", items[i]);
         var rendered = render(i, items[i]);



Mime
View raw message