r3095 committed - autocomplete: Fix to trigger result callback (with no data) when mustM...

r3095 committed - autocomplete: Fix to trigger result callback (with no data) when mustM...


Revision: 3095
Author: joern.zaefferer
Date: Thu Aug 20 11:37:30 2009
Log: autocomplete: Fix to trigger result callback (with no data) when
mustMatch is true and no value was selecting (what the user entered was
removed)
http://code.google.com/p/jquery-ui/source/detail?r=3095
Modified:
/branches/dev/autocomplete/ui/ui.autocomplete.js
=======================================
--- /branches/dev/autocomplete/ui/ui.autocomplete.js    Tue Jun 23 06:01:10
2009
+++ /branches/dev/autocomplete/ui/ui.autocomplete.js    Thu Aug 20 11:37:30
2009
@@ -232,19 +232,13 @@
        // TODO without the multiple stuff, this shouldn't be necessary anymore
        function trimWords(value) {
-            if ( !value ) {
+            if (!value)
                return [""];
-            }
-            if ( !options.multiple ) {
-                return [value];
-            }
-            var words = value.split( options.multipleSeparator );
-            var result = [];
-            $.each(words, function(i, value) {
-                if ( $.trim(value) )
-                    result[i] = $.trim(value);
+            if (!options.multiple)
+                return [$.trim(value)];
+            return $.map(value.split(options.multipleSeparator), function(word) {
+                return $.trim(value).length ? $.trim(word) : null;
            });
-            return result;
        };
        // TODO should be abl to remove this, too