diff --git a/frontend_tests/node_tests/activity.js b/frontend_tests/node_tests/activity.js index cc0f1d7900..7b68ad51b2 100644 --- a/frontend_tests/node_tests/activity.js +++ b/frontend_tests/node_tests/activity.js @@ -522,7 +522,7 @@ $('.user-list-filter').is = function (sel) { (function test_clear_search() { $('.user-list-filter').val('somevalue'); - $('#clear_search_people_button').removeAttr('disabled'); + $('#clear_search_people_button').prop('disabled', false); $('.user-list-filter').focus(); activity.clear_search(); assert.equal($('.user-list-filter').val(), ''); @@ -536,7 +536,7 @@ $('.user-list-filter').is = function (sel) { $('#clear_search_people_button').attr('disabled', 'disabled'); activity.blur_search(); assert.equal($('.user-list-filter').is_focused(), false); - assert.equal($('#clear_search_people_button').attr('disabled'), undefined); + assert.equal($('#clear_search_people_button').prop('disabled'), false); $('.user-list-filter').val(''); activity.blur_search(); assert.equal($('#clear_search_people_button').attr('disabled'), 'disabled'); @@ -553,14 +553,14 @@ $('.user-list-filter').is = function (sel) { activity.escape_search(); assert.equal($('.user-list-filter').is_focused(), false); $('.user-list-filter').val('foobar'); - $('#clear_search_people_button').removeAttr('disabled'); + $('#clear_search_people_button').prop('disabled', false); activity.escape_search(); assert.equal($('.user-list-filter').val(), ''); assert.equal($('#clear_search_people_button').attr('disabled'), 'disabled'); $('.user-list-filter').focus(); $('.user-list-filter').val('foobar'); activity.escape_search(); - assert.equal($('#clear_search_people_button').attr('disabled'), undefined); + assert.equal($('#clear_search_people_button').prop('disabled'), false); }()); (function test_searching() { diff --git a/frontend_tests/node_tests/compose.js b/frontend_tests/node_tests/compose.js index ed22bb9ada..218869d9e6 100644 --- a/frontend_tests/node_tests/compose.js +++ b/frontend_tests/node_tests/compose.js @@ -138,14 +138,14 @@ people.add(bob); }()); (function test_validate() { - $("#compose-send-button").removeAttr('disabled'); + $("#compose-send-button").prop('disabled', false); $("#compose-send-button").focus(); $("#sending-indicator").hide(); $("#new_message_content").select(noop); assert(!compose.validate()); assert(!$("#sending-indicator").visible()); assert(!$("#compose-send-button").is_focused()); - assert.equal($("#compose-send-button").attr('disabled'), undefined); + assert.equal($("#compose-send-button").prop('disabled'), false); assert.equal($('#error-msg').html(), i18n.t('You have nothing to send!')); $("#new_message_content").val('foobarfoobar'); @@ -247,7 +247,7 @@ people.add(bob); }; compose_state.message_content('Hey @all'); assert(!compose.validate()); - assert.equal($("#compose-send-button").attr('disabled'), undefined); + assert.equal($("#compose-send-button").prop('disabled'), false); assert(!$("#send-status").visible()); assert.equal(compose_content, 'compose_all_everyone_stub'); assert($("#compose-all-everyone").visible()); @@ -286,7 +286,7 @@ people.add(bob); assert.equal($("#new_message_content").val(), ''); assert($("#new_message_content").is_focused()); assert(!$("#send-status").visible()); - assert.equal($("#compose-send-button").attr('disabled'), undefined); + assert.equal($("#compose-send-button").prop('disabled'), false); assert(!$("#sending-indicator").visible()); assert.equal(_.keys(compose.send_times_data).length, 1); assert.equal(compose.send_times_data[12].start.getTime(), new Date(test_date).getTime()); @@ -418,7 +418,7 @@ people.add(bob); assert.equal($("#new_message_content").val(), ''); assert($("#new_message_content").is_focused()); assert(!$("#send-status").visible()); - assert.equal($("#compose-send-button").attr('disabled'), undefined); + assert.equal($("#compose-send-button").prop('disabled'), false); assert(!$("#sending-indicator").visible()); }()); @@ -528,13 +528,13 @@ people.add(bob); assert(!reload_initiate_triggered); assert(xhr_error_msg_checked); assert(!echo_error_msg_checked); - assert.equal($("#compose-send-button").attr('disabled'), undefined); + assert.equal($("#compose-send-button").prop('disabled'), false); assert.equal($('#error-msg').html(), 'Error sending message: Server says 408'); assert.equal($("#new_message_content").val(), 'foobarfoobar'); assert($("#new_message_content").is_focused()); assert($("#send-status").visible()); - assert.equal($("#compose-send-button").attr('disabled'), undefined); + assert.equal($("#compose-send-button").prop('disabled'), false); assert(!$("#sending-indicator").visible()); }()); }()); @@ -565,7 +565,7 @@ people.add(bob); (function test_finish() { (function test_when_compose_validation_fails() { $("#compose_invite_users").show(); - $("#compose-send-button").removeAttr('disabled'); + $("#compose-send-button").prop('disabled', false); $("#compose-send-button").focus(); $("#sending-indicator").hide(); $("#new_message_content").select(noop); @@ -575,7 +575,7 @@ people.add(bob); assert(!$("#compose_invite_users").visible()); assert(!$("#sending-indicator").visible()); assert(!$("#compose-send-button").is_focused()); - assert.equal($("#compose-send-button").attr('disabled'), undefined); + assert.equal($("#compose-send-button").prop('disabled'), false); assert.equal($('#error-msg').html(), i18n.t('You have nothing to send!')); }()); @@ -1051,7 +1051,7 @@ function test_with_mock_socket(test_params) { }; var invite_err_sel = '.compose_invite_user_error'; container.set_find_results(invite_err_sel, $(invite_err_sel)); - target.removeAttr('disabled'); + target.prop('disabled', false); $(invite_err_sel).hide(); handler(event); @@ -1269,7 +1269,7 @@ function test_with_mock_socket(test_params) { }()); (function test_upload_started() { - $("#compose-send-button").removeAttr('disabled'); + $("#compose-send-button").prop('disabled', false); $("#send-status").removeClass("alert-info").hide(); $(".send-status-close").one = function (ev_name, handler) { assert.equal(ev_name, 'click'); @@ -1314,7 +1314,7 @@ function test_with_mock_socket(test_params) { function assert_side_effects(msg) { assert($("#send-status").hasClass("alert-error")); assert(!$("#send-status").hasClass("alert-info")); - assert.equal($("#compose-send-button").attr("disabled"), undefined); + assert.equal($("#compose-send-button").prop("disabled"), false); assert.equal($("#error-msg").text(), msg); } @@ -1388,7 +1388,7 @@ function test_with_mock_socket(test_params) { if (response.uri) { assert(compose_actions_start_checked); assert(compose_ui_autosize_textarea_checked); - assert.equal($("#compose-send-button").attr('disabled'), undefined); + assert.equal($("#compose-send-button").prop('disabled'), false); assert(!$('#send-status').hasClass('alert-info')); assert(!$('#send-status').visible()); assert(clear_out_file_input_triggered); diff --git a/frontend_tests/node_tests/settings_org.js b/frontend_tests/node_tests/settings_org.js index 72a227bacd..8b0e3de734 100644 --- a/frontend_tests/node_tests/settings_org.js +++ b/frontend_tests/node_tests/settings_org.js @@ -334,7 +334,7 @@ function test_change_message_editing(change_message_editing) { change_message_editing.apply({checked: true}); assert(!parent_elem.hasClass('control-label-disabled')); - assert.equal($('#id_realm_message_content_edit_limit_minutes').attr('disabled'), undefined); + assert.equal($('#id_realm_message_content_edit_limit_minutes').prop('disabled'), false); } function test_change_invite_required(change_invite_required) { @@ -348,7 +348,7 @@ function test_change_invite_required(change_invite_required) { change_invite_required.apply({checked: true}); assert(!parent_elem.hasClass('control-label-disabled')); - assert.equal($('#id_realm_invite_by_admins_only').attr('disabled'), undefined); + assert.equal($('#id_realm_invite_by_admins_only').prop('disabled'), false); } function test_disable_notifications_stream(disable_notifications_stream) { @@ -506,7 +506,7 @@ function test_change_allow_subdomains(change_allow_subdomains) { $('#full_name').attr('disabled', 'disabled'); settings_org.toggle_name_change_display(); - assert.equal($('#full_name').attr('disabled'), undefined); + assert.equal($('#full_name').prop('disabled'), false); assert(name_toggled); settings_org.toggle_name_change_display(); diff --git a/static/js/activity.js b/static/js/activity.js index 289e85414e..6d62c5d586 100644 --- a/static/js/activity.js +++ b/static/js/activity.js @@ -494,7 +494,7 @@ function update_clear_search_button() { // Show button iff the search input is focused, or has non-empty contents if (focused || $('.user-list-filter').val()) { - $('#clear_search_people_button').removeAttr('disabled'); + $('#clear_search_people_button').prop('disabled', false); } else { $('#clear_search_people_button').attr('disabled', 'disabled'); } diff --git a/static/js/compose.js b/static/js/compose.js index e2ed5ac354..110051ec71 100644 --- a/static/js/compose.js +++ b/static/js/compose.js @@ -91,7 +91,7 @@ function update_fade() { } exports.abort_xhr = function () { - $("#compose-send-button").removeAttr("disabled"); + $("#compose-send-button").prop("disabled", false); var xhr = $("#compose").data("filedrop_xhr"); if (xhr !== undefined) { xhr.abort(); @@ -150,7 +150,7 @@ function compose_error(error_text, bad_input) { .addClass('alert-error') .stop(true).fadeTo(0, 1); $('#error-msg').html(error_text); - $("#compose-send-button").removeAttr('disabled'); + $("#compose-send-button").prop('disabled', false); $("#sending-indicator").hide(); if (bad_input !== undefined) { bad_input.focus().select(); @@ -279,7 +279,7 @@ function clear_compose_box() { drafts.delete_draft_after_send(); compose_ui.autosize_textarea(); $("#send-status").hide(0); - $("#compose-send-button").removeAttr('disabled'); + $("#compose-send-button").prop('disabled', false); $("#sending-indicator").hide(); resize.resize_bottom_whitespace(); } @@ -457,7 +457,7 @@ function validate_stream_message_mentions(stream_name) { // user has not seen a warning message yet if undefined show_all_everyone_warnings(); - $("#compose-send-button").removeAttr('disabled'); + $("#compose-send-button").prop('disabled', false); $("#sending-indicator").hide(); return false; } @@ -799,7 +799,7 @@ exports.initialize = function () { var msg; $("#send-status").addClass("alert-error") .removeClass("alert-info"); - $("#compose-send-button").removeAttr("disabled"); + $("#compose-send-button").prop("disabled", false); switch (err) { case 'BrowserNotSupported': msg = i18n.t("File upload is not yet available for your browser."); @@ -849,7 +849,7 @@ exports.initialize = function () { textbox.val(textbox.val() + "[" + filename + "](" + uri + ")" + " "); } compose_ui.autosize_textarea(); - $("#compose-send-button").removeAttr("disabled"); + $("#compose-send-button").prop("disabled", false); $("#send-status").removeClass("alert-info") .hide(); diff --git a/static/js/search.js b/static/js/search.js index eaa41327f6..40736ae549 100644 --- a/static/js/search.js +++ b/static/js/search.js @@ -26,7 +26,7 @@ function update_buttons_with_focus(focused) { if (focused || search_query.val() || narrow_state.active()) { - $('.search_button').removeAttr('disabled'); + $('.search_button').prop('disabled', false); } else { $('.search_button').attr('disabled', 'disabled'); } diff --git a/static/js/settings_notifications.js b/static/js/settings_notifications.js index 54eb4045f8..99d0c555d5 100644 --- a/static/js/settings_notifications.js +++ b/static/js/settings_notifications.js @@ -77,10 +77,10 @@ exports.set_up = function () { $("#enable_desktop_notifications").change(function () { if (this.checked) { - $("#pm_content_in_desktop_notifications").removeAttr("disabled"); + $("#pm_content_in_desktop_notifications").prop("disabled", false); $("#pm_content_in_desktop_notifications_label").parent().removeClass("control-label-disabled"); } else { - $("#pm_content_in_desktop_notifications").attr("disabled", true); + $("#pm_content_in_desktop_notifications").prop("disabled", true); $("#pm_content_in_desktop_notifications_label").parent().addClass("control-label-disabled"); } }); diff --git a/static/js/settings_org.js b/static/js/settings_org.js index 234486ec55..5850b16031 100644 --- a/static/js/settings_org.js +++ b/static/js/settings_org.js @@ -49,7 +49,7 @@ exports.toggle_name_change_display = function () { } if ($('#full_name').attr('disabled')) { - $('#full_name').removeAttr('disabled'); + $('#full_name').prop('disabled', false); } else { $('#full_name').attr('disabled', 'disabled'); } @@ -311,7 +311,7 @@ function _set_up() { $("#id_realm_invite_required").change(function () { if (this.checked) { - $("#id_realm_invite_by_admins_only").removeAttr("disabled"); + $("#id_realm_invite_by_admins_only").prop("disabled", false); $("#id_realm_invite_by_admins_only_label").parent().removeClass("control-label-disabled"); } else { $("#id_realm_invite_by_admins_only").attr("disabled", true); @@ -321,7 +321,7 @@ function _set_up() { $("#id_realm_allow_message_editing").change(function () { if (this.checked) { - $("#id_realm_message_content_edit_limit_minutes").removeAttr("disabled"); + $("#id_realm_message_content_edit_limit_minutes").prop("disabled", false); $("#id_realm_message_content_edit_limit_minutes_label").parent().removeClass("control-label-disabled"); } else { $("#id_realm_message_content_edit_limit_minutes").attr("disabled", true); diff --git a/static/js/stream_edit.js b/static/js/stream_edit.js index c6129d4d4d..fe7b0296d9 100644 --- a/static/js/stream_edit.js +++ b/static/js/stream_edit.js @@ -256,7 +256,7 @@ function stream_home_view_clicked(e) { if (sub.in_home_view) { sub_settings.find(".mute-note").addClass("hide-mute-note"); notification_checkboxes.removeClass("muted-sub"); - notification_checkboxes.find("input[type='checkbox']").removeAttr("disabled"); + notification_checkboxes.find("input[type='checkbox']").prop("disabled", false); } else { sub_settings.find(".mute-note").removeClass("hide-mute-note"); notification_checkboxes.addClass("muted-sub"); diff --git a/static/js/stream_list.js b/static/js/stream_list.js index 45a198a834..d57e686c30 100644 --- a/static/js/stream_list.js +++ b/static/js/stream_list.js @@ -537,7 +537,7 @@ exports.initiate_search = function () { var filter = $('.stream-list-filter').expectOne(); filter.parent().removeClass('notdisplayed'); filter.focus(); - $('#clear_search_stream_button').removeAttr('disabled'); + $('#clear_search_stream_button').prop('disabled', false); }; exports.clear_and_hide_search = function () { diff --git a/static/third/jquery-form/jquery.form.js b/static/third/jquery-form/jquery.form.js index 13e9a55c58..c31c6b77c1 100644 --- a/static/third/jquery-form/jquery.form.js +++ b/static/third/jquery-form/jquery.form.js @@ -281,7 +281,7 @@ $.fn.ajaxSubmit = function(options) { if ( useProp ) el.prop('disabled', false); else - el.removeAttr('disabled'); + el.prop('disabled', false); } }