Modified:
/branches/dev/demos/autocomplete/combobox.html
/branches/dev/demos/autocomplete/remote-jsonp.html
/branches/dev/demos/autocomplete/remote-with-cache.html
/branches/dev/demos/autocomplete/remote.html
/branches/dev/tests/visual/autocomplete/combobox.html
/branches/dev/tests/visual/autocomplete/default.html
/branches/dev/tests/visual/autocomplete/remote-jsonp.html
/branches/dev/tests/visual/autocomplete/remote-with-cache.html
/branches/dev/tests/visual/autocomplete/remote.html
/branches/dev/ui/jquery.ui.autocomplete.js
=======================================
--- /branches/dev/demos/autocomplete/combobox.html Wed Dec 16 18:23:07 2009
+++ /branches/dev/demos/autocomplete/combobox.html Wed Jan 6 09:56:20 2010
@@ -25,7 +25,7 @@
return {
id: $(this).val(),
label: text.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" +
request.term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1")
+ ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>"),
- result: text
+ value: text
};
});
},
=======================================
--- /branches/dev/demos/autocomplete/remote-jsonp.html Wed Dec 16 18:23:07
2009
+++ /branches/dev/demos/autocomplete/remote-jsonp.html Wed Jan 6 09:56:20
2010
@@ -31,7 +31,7 @@
response($.map(data.geonames, function(item) {
return {
label: item.name + (item.adminName1 ? ", " + item.adminName1 : "")
+ ", " + item.countryName,
- result: item.name
+ value: item.name
}
}))
}
=======================================
--- /branches/dev/demos/autocomplete/remote-with-cache.html Wed Dec 16
18:23:07 2009
+++ /branches/dev/demos/autocomplete/remote-with-cache.html Wed Jan 6
09:56:20 2010
@@ -25,7 +25,7 @@
if (new RegExp(cache.term).test(request.term) && cache.content &&
cache.content.length < 13) {
var matcher = new
RegExp($.ui.autocomplete.escapeRegex(request.term), "i");
return $.grep(cache.content, function(value) {
- return matcher.test(value.result)
+ return matcher.test(value.value)
});
}
$.ajax({
@@ -41,7 +41,7 @@
},
minLength: 2,
change: function(event, ui) {
- log(ui.item ? ("Selected: " + ui.item.result + " aka " +
ui.item.id) : "Nothing selected, input was " + this.value);
+ log(ui.item ? ("Selected: " + ui.item.value + " aka " +
ui.item.id) : "Nothing selected, input was " + this.value);
}
});
});
@@ -68,7 +68,7 @@
The Autocomplete widgets provides suggestions while you type into the
field. Here the suggestions are bird names, displayed when at least two
characters are entered into the field.
</p>
<p>
-Similar to the remote datasource demo, though this adds some local caching
to improve performance. The cache here saves just one query, and could be
extended to cache multiple results, one for each term.
+Similar to the remote datasource demo, though this adds some local caching
to improve performance. The cache here saves just one query, and could be
extended to cache multiple values, one for each term.
</p>
</div><!-- End demo-description -->
=======================================
--- /branches/dev/demos/autocomplete/remote.html Wed Dec 16 18:23:07 2009
+++ /branches/dev/demos/autocomplete/remote.html Wed Jan 6 09:56:20 2010
@@ -21,7 +21,7 @@
source: "search.php",
minLength: 2,
change: function(event, ui) {
- log(ui.item ? ("Selected: " + ui.item.result + " aka " +
ui.item.id) : "Nothing selected, input was " + this.value);
+ log(ui.item ? ("Selected: " + ui.item.value + " aka " +
ui.item.id) : "Nothing selected, input was " + this.value);
}
});
});
=======================================
--- /branches/dev/tests/visual/autocomplete/combobox.html Wed Dec 16
18:23:07 2009
+++ /branches/dev/tests/visual/autocomplete/combobox.html Wed Jan 6
09:56:20 2010
@@ -27,7 +27,7 @@
return {
id: $(this).val(),
label: text.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" +
request.term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1")
+ ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>"),
- result: text
+ value: text
};
});
},
=======================================
--- /branches/dev/tests/visual/autocomplete/default.html Wed Dec 16
18:23:07 2009
+++ /branches/dev/tests/visual/autocomplete/default.html Wed Jan 6
09:56:20 2010
@@ -41,7 +41,7 @@
log("Hiding suggestions");
},
change: function(event, ui) {
- log(ui.item ? ("Selected: " + ui.item.result) : "Nothing selected,
input was " + this.value);
+ log(ui.item ? ("Selected: " + ui.item.value) : "Nothing selected,
input was " + this.value);
}
});
}
=======================================
--- /branches/dev/tests/visual/autocomplete/remote-jsonp.html Wed Dec 16
18:23:07 2009
+++ /branches/dev/tests/visual/autocomplete/remote-jsonp.html Wed Jan 6
09:56:20 2010
@@ -39,7 +39,7 @@
response($.map(data.geonames, function(item) {
return {
label: item.name + (item.adminName1 ? ", " + item.adminName1 : "")
+ ", " + item.countryName,
- result: item.name
+ value: item.name
}
}))
}
=======================================
--- /branches/dev/tests/visual/autocomplete/remote-with-cache.html Wed Dec
16 18:23:07 2009
+++ /branches/dev/tests/visual/autocomplete/remote-with-cache.html Wed Jan
6 09:56:20 2010
@@ -36,7 +36,7 @@
if (new RegExp(cache.term).test(request.term) && cache.content &&
cache.content.length < cache.limit) {
var matcher = new
RegExp($.ui.autocomplete.escapeRegex(request.term), "i");
return $.grep(cache.content, function(value) {
- return matcher.test(value.result)
+ return matcher.test(value.value)
});
}
$.ajax({
@@ -64,7 +64,7 @@
log("Hiding suggestions");
},
change: function(event, ui) {
- log(ui.item ? ("Selected: " + ui.item.result + " aka " +
ui.item.id) : "Nothing selected, input was " + this.value);
+ log(ui.item ? ("Selected: " + ui.item.value + " aka " +
ui.item.id) : "Nothing selected, input was " + this.value);
}
});
});
=======================================
--- /branches/dev/tests/visual/autocomplete/remote.html Wed Dec 16 18:23:07
2009
+++ /branches/dev/tests/visual/autocomplete/remote.html Wed Jan 6 09:56:20
2010
@@ -40,7 +40,7 @@
log("Hiding suggestions");
},
change: function(event, ui) {
- log(ui.item ? ("Selected: " + ui.item.result + " aka " +
ui.item.id) : "Nothing selected, input was " + this.value);
+ log(ui.item ? ("Selected: " + ui.item.value + " aka " +
ui.item.id) : "Nothing selected, input was " + this.value);
}
});
});
=======================================
--- /branches/dev/ui/jquery.ui.autocomplete.js Sat Jan 2 08:16:06 2010
+++ /branches/dev/ui/jquery.ui.autocomplete.js Wed Jan 6 09:56:20 2010
@@ -169,12 +169,12 @@
if (typeof item == "string") {
return {
label: item,
- result: item
+ value: item
};
}
return $.extend({
- label: item.label || item.result,
- result: item.result || item.label
+ label: item.label || item.value,
+ value: item.value || item.label
}, item);
});
},
@@ -195,15 +195,15 @@
.menu({
focus: function(event, ui) {
self._trigger("focus", null, { item:
ui.item.data("item.autocomplete") });
- // use result to match what will end up in the input
- self.element.val(ui.item.data("item.autocomplete").result);
+ // use value to match what will end up in the input
+ self.element.val(ui.item.data("item.autocomplete").value);
},
selected: function(event, ui) {
var data = ui.item.data("item.autocomplete");
- self.element.val( data.result );
+ self.element.val( data.value );
self.close({ item: data });
// prevent the blur handler from triggering another change event
- self.previous = data.result;
+ self.previous = data.value;
// TODO only trigger when focus was lost?
self.element.focus();
}