replace $().attr('checked') by $().prop('checked', state) or $().is(':checked')

This commit is contained in:
Christoph Wurst 2016-04-19 15:13:37 +02:00
parent 05d203a989
commit e4a8456d01
No known key found for this signature in database
GPG Key ID: FEECD2543CA6EAF0
7 changed files with 15 additions and 15 deletions

View File

@ -391,7 +391,7 @@ OCA = OCA || {};
*/
_setCheckBox: function($element, value) {
if(parseInt(value, 10) === 1) {
$element.attr('checked', 'checked');
$element.prop('checked', 'checked');
} else {
$element.removeAttr('checked');
}

View File

@ -1,7 +1,7 @@
{
"vendor": [
"jquery/dist/jquery.min.js",
"jquery-migrate/jquery-migrate.js",
"jquery-migrate/jquery-migrate.min.js",
"jquery-ui/ui/jquery-ui.custom.js",
"underscore/underscore.js",
"moment/min/moment-with-locales.js",

View File

@ -81,12 +81,12 @@ OC.Lostpassword = {
$('#password').parents('form').attr('action'),
{
password : $('#password').val(),
proceed: $('#encrypted-continue').attr('checked') ? 'true' : 'false'
proceed: $('#encrypted-continue').is(':checked') ? 'true' : 'false'
},
OC.Lostpassword.resetDone
);
}
if($('#encrypted-continue').attr('checked')) {
if($('#encrypted-continue').is(':checked')) {
$('#reset-password #submit').hide();
$('#reset-password #float-spinner').removeClass('hidden');
}

View File

@ -120,7 +120,7 @@
label.text(element.text() || item);
label.attr('title', element.text() || item);
if(settings.checked.indexOf(item) !== -1 || checked) {
input.attr('checked', true);
input.prop('checked', true);
}
if(checked){
if(settings.singleSelect) {
@ -145,7 +145,7 @@
element.attr('selected','selected');
if(typeof settings.oncheck === 'function') {
if(settings.oncheck(value)===false) {
$(this).attr('checked', false);
$(this).prop('checked', false);
return;
}
}
@ -157,7 +157,7 @@
element.attr('selected',null);
if(typeof settings.onuncheck === 'function') {
if(settings.onuncheck(value)===false) {
$(this).attr('checked',true);
$(this).prop('checked',true);
return;
}
}

View File

@ -268,11 +268,11 @@
if ($element.attr('name') === 'edit') {
checked = $element.is(':checked');
// Check/uncheck Create, Update, and Delete checkboxes if Edit is checked/unck
$($checkboxes).attr('checked', checked);
$($checkboxes).prop('checked', checked);
} else {
var numberChecked = $checkboxes.filter(':checked').length;
checked = numberChecked > 0;
$('input[name="edit"]', $li).attr('checked', checked);
$('input[name="edit"]', $li).prop('checked', checked);
}
var permissions = OC.PERMISSION_READ;

View File

@ -38,7 +38,7 @@ $(document).ready(function(){
$('#backgroundjobs span.crondate').tipsy({gravity: 's', live: true});
$('#backgroundjobs input').change(function(){
if($(this).attr('checked')){
if($(this).is(':checked')){
var mode = $(this).val();
if (mode === 'ajax' || mode === 'webcron' || mode === 'cron') {
OC.AppConfig.setValue('core', 'backgroundjobs_mode', mode);
@ -131,7 +131,7 @@ $(document).ready(function(){
$('#setting_smtphost').removeClass('hidden');
$('#mail_smtpsecure_label').removeClass('hidden');
$('#mail_smtpsecure').removeClass('hidden');
if ($('#mail_smtpauth').attr('checked')) {
if ($('#mail_smtpauth').is(':checked')) {
$('#mail_credentials').removeClass('hidden');
}
}

View File

@ -193,15 +193,15 @@ OC.Settings.Apps = OC.Settings.Apps || {
OC.Settings.Apps.isType(app, 'authentication') || OC.Settings.Apps.isType(app, 'logging') ||
OC.Settings.Apps.isType(app, 'prevent_group_restriction')) {
page.find(".groups-enable").hide();
page.find(".groups-enable__checkbox").attr('checked', null);
page.find(".groups-enable__checkbox").prop('checked', false);
} else {
page.find('#group_select').val((app.groups || []).join('|'));
if (app.active) {
if (app.groups.length) {
OC.Settings.Apps.setupGroupsSelect(page.find('#group_select'));
page.find(".groups-enable__checkbox").attr('checked','checked');
page.find(".groups-enable__checkbox").prop('checked', true);
} else {
page.find(".groups-enable__checkbox").attr('checked', null);
page.find(".groups-enable__checkbox").prop('checked', false);
}
page.find(".groups-enable").show();
} else {
@ -289,7 +289,7 @@ OC.Settings.Apps = OC.Settings.Apps || {
if (OC.Settings.Apps.isType(app, 'filesystem') || OC.Settings.Apps.isType(app, 'prelogin') ||
OC.Settings.Apps.isType(app, 'authentication') || OC.Settings.Apps.isType(app, 'logging')) {
element.parent().find(".groups-enable").attr('checked', null);
element.parent().find(".groups-enable").prop('checked', true);
element.parent().find(".groups-enable").hide();
element.parent().find('#group_select').hide().val(null);
} else {