[Jifty-commit] jifty branch, autocomplete-refactor, updated. d07e5cc75631160c1a7c274620a3de47c92ee8be

Jifty commits jifty-commit at lists.jifty.org
Wed Mar 24 16:22:55 EDT 2010


The branch, autocomplete-refactor has been updated
       via  d07e5cc75631160c1a7c274620a3de47c92ee8be (commit)
      from  6e0a4bd85a6dce697334c3c557212480329eef10 (commit)

Summary of changes:
 share/web/static/js/jifty.js |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)

- Log -----------------------------------------------------------------
commit d07e5cc75631160c1a7c274620a3de47c92ee8be
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Wed Mar 24 16:22:44 2010 -0400

    Deal with jQuery being ornery about (I guess) external XML

diff --git a/share/web/static/js/jifty.js b/share/web/static/js/jifty.js
index 9cc9066..931bae2 100644
--- a/share/web/static/js/jifty.js
+++ b/share/web/static/js/jifty.js
@@ -1739,10 +1739,26 @@ Jifty.addAutocompleter = function (id) {
         parse: function (data) {
             var results = [];
             jQuery(data).find("li").each(function () {
-                var label = jQuery(this).find(".informal").text();
-                var value = jQuery(this).find(".hidden_value").text();
 
-                if (value == '') {
+                var label, value;
+                jQuery(this).find("span").each(function () {
+                    var el = jQuery(this);
+
+                    // argh this is awful but hasClass('informal') returns false!?
+                    if (el.attr('class') == 'informal') {
+                        label = el.text();
+                    }
+                    else if (el.attr('class') == 'hidden_value') {
+                        value = el.text();
+                    }
+                });
+
+                // the above *should* be just the following but jQuery is kicking
+                // my puppies
+                // var label = jQuery(this).find(".informal").text();
+                // var value = jQuery(this).find(".hidden_value").text();
+
+                if (value === undefined) {
                     label = jQuery(this).text();
                     value = label;
                 }

-----------------------------------------------------------------------


More information about the Jifty-commit mailing list