From a9c2e4fe300b69330a7715b7cc20e0994a3ef56a Mon Sep 17 00:00:00 2001 From: Maximilian Mader Date: Sat, 26 Sep 2015 23:27:41 +0200 Subject: [PATCH] Fix uncaught TypeError in Safari 8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit jQuery's “.focus()” returns undefined in Safari 8, thus the following error will be thrown and sending of messages is impossible: “Uncaught TypeError: Cannot read property 'change' of undefined” --- file/js/be.bastelstu.Chat.litcoffee | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/file/js/be.bastelstu.Chat.litcoffee b/file/js/be.bastelstu.Chat.litcoffee index d983f44..9ad7bbd 100644 --- a/file/js/be.bastelstu.Chat.litcoffee +++ b/file/js/be.bastelstu.Chat.litcoffee @@ -190,7 +190,10 @@ and afterwards sent to the server by an AJAX request. do event.preventDefault text = do $('#timsChatInput').val().trim - $('#timsChatInput').val('').focus().change() + input = $ '#timsChatInput' + input.val '' + do input.focus + do input.change return false if text.length is 0