summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--awesomplete.js24
1 files changed, 14 insertions, 10 deletions
diff --git a/awesomplete.js b/awesomplete.js
index 06391ef..d7857e7 100644
--- a/awesomplete.js
+++ b/awesomplete.js
@@ -24,16 +24,8 @@ var _ = function (input, o) {
autoFirst: false,
filter: _.FILTER_CONTAINS,
sort: _.SORT_BYLENGTH,
- item: function (text, input) {
- var html = input === '' ? text : text.replace(RegExp($.regExpEscape(input.trim()), "gi"), "<mark>$&</mark>");
- return $.create("li", {
- innerHTML: html,
- "aria-selected": "false"
- });
- },
- replace: function (text) {
- this.input.value = text;
- }
+ item: _.ITEM,
+ replace: _.REPLACE
}, o);
this.index = -1;
@@ -260,6 +252,18 @@ _.SORT_BYLENGTH = function (a, b) {
return a < b? -1 : 1;
};
+_.ITEM = function (text, input) {
+ var html = input === '' ? text : text.replace(RegExp($.regExpEscape(input.trim()), "gi"), "<mark>$&</mark>");
+ return $.create("li", {
+ innerHTML: html,
+ "aria-selected": "false"
+ });
+};
+
+_.REPLACE = function (text) {
+ this.input.value = text;
+};
+
// Private functions
function configure(instance, properties, o) {