Permalink
Browse files

fix IE bug: forEach and indexOf are broken => replace it by jQuery wr…

…appers
  • Loading branch information...
1 parent 19dbb80 commit feec4bc9dd3b617a27e71ebb1e097644a3127d2b @kerphi committed Dec 30, 2012
Showing with 4 additions and 4 deletions.
  1. +3 −3 client/jquery.phpfreechat.core.js
  2. +1 −1 client/jquery.phpfreechat.init.js
@@ -25,7 +25,7 @@ var phpFreeChat = (function (pfc, $, window, undefined) {
// reset the error counter because a request has been well received
pfc.readPendingMessages.nb_network_error = 0;
- msgs.forEach(function (m, i) {
+ $.each(msgs, function (i, m) {
// specific actions for special messages
if (m.type == 'join') {
pfc.users[m.sender] = m.body; // store new joined user data
@@ -199,10 +199,10 @@ var phpFreeChat = (function (pfc, $, window, undefined) {
if (user.id === 0) {
do {
user.id = Math.round(Math.random() * 10000);
- } while (userids.indexOf(user.id) != -1);
+ } while ($.inArray(user.id ,userids) !== -1);
}
// add the id in the user's dom element
- if (user.id !== 0 && userids.indexOf(user.id) == -1) {
+ if (user.id !== 0 && $.inArray(user.id, userids) === -1) {
html.attr('id', 'user_' + user.id);
} else {
return 0;
@@ -320,7 +320,7 @@ var phpFreeChat = (function (pfc, $, window, undefined) {
*/
pfc.showErrorsPopup = function (errors) {
var popup = $('<ul class="pfc-errors"></ul>');
- errors.forEach(function (err) {
+ $.each(errors, function (i, err) {
popup.append($('<li></li>').text(err));
});
pfc.modalbox.open(popup);

0 comments on commit feec4bc

Please sign in to comment.