Skip to content
This repository has been archived by the owner on Sep 10, 2023. It is now read-only.

Mobile safari issues #875

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 32 additions & 25 deletions src/jquery.tokeninput.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,26 +323,6 @@

break;

case KEY.BACKSPACE:
previous_token = input_token.prev();

if (this.value.length === 0) {
if (selected_token) {
delete_token($(selected_token));
hiddenInput.change();
} else if(previous_token.length) {
select_token($(previous_token.get(0)));
}

return false;
} else if($(this).val().length === 1) {
hide_dropdown();
} else {
// set a timeout just long enough to let this function finish.
setTimeout(function(){ do_search(); }, 5);
}
break;

case KEY.TAB:
case KEY.ENTER:
case KEY.NUMPAD_ENTER:
Expand Down Expand Up @@ -371,6 +351,32 @@
case KEY.ESCAPE:
hide_dropdown();
return true;
}
})
.keyup(function (event) {
var previous_token;
var next_token;

switch(event.keyCode) {
case KEY.BACKSPACE:
previous_token = input_token.prev();

if (this.value.length === 0) {
if (selected_token) {
delete_token($(selected_token));
hiddenInput.change();
} else if(previous_token.length) {
select_token($(previous_token.get(0)));
}

return false;
} else if($(this).val().length === 1) {
hide_dropdown();
} else {
// set a timeout just long enough to let this function finish.
setTimeout(function(){ do_search(); }, 5);
}
break;

default:
if (String.fromCharCode(event.which)) {
Expand Down Expand Up @@ -1067,11 +1073,12 @@
// obj: a jQuery object to focus()
function focusWithTimeout(object) {
setTimeout(
function() {
object.focus();
},
50
);
function() {
object.focus();
},
50
);
object.focus();
}
};

Expand Down