Commit 23a1f6ff authored by jonnybradley's avatar jonnybradley

[FIX] jquery: Global replace of deprecated .attr("checked") calls with prop()

parent fa502f09
......@@ -60,7 +60,7 @@ $.fn.reportBuilder = function(o, prefix) {
.toggle(function() {
obj.find(':checkbox').removeAttr('checked');
}, function() {
obj.find(':checkbox').attr('checked', true);
obj.find(':checkbox').prop('checked', true);
})
.appendTo(this);
},
......@@ -409,7 +409,7 @@ $.fn.reportBuilderImport = function(data, o) {
input
.each(function() {
if ($(this).val() == dataItem[type]) {
$(this).attr('checked', true);
$(this).prop('checked', true);
}
})
.change();
......
......@@ -17,7 +17,7 @@ function escapeJquery(str) {
function switchCheckboxes (tform, elements_name, state) {
// checkboxes need to have the same name elements_name
// e.g. <input type="checkbox" name="my_ename[]">, will arrive as Array in php.
$(tform).contents().find('input[name="' + escapeJquery(elements_name) + '"]:visible').attr('checked', state).change();
$(tform).contents().find('input[name="' + escapeJquery(elements_name) + '"]:visible').prop('checked', state).change();
}
......@@ -181,7 +181,7 @@ function checkDuplicateRows( button, columnSelector, rowSelector ) {
$rows.each(function( ix, el ){
if ($el[0] !== el && $("input:checked", el).length === 0) {
if (line === $(el).find(columnSelector).text()) {
$(":checkbox:first", el).attr("checked", true);
$(":checkbox:first", el).prop("checked", true);
}
}
});
......@@ -453,7 +453,7 @@ $(function() { // JQuery's DOM is ready event - before onload
});
var keepopen = getCookie("fgalKeepOpen");
if (keepopen) {
$("#keepOpenCbx").attr("checked", "checked");
$("#keepOpenCbx").prop("checked", "checked");
} else {
$("#keepOpenCbx").removeAttr("checked");
}
......@@ -471,7 +471,7 @@ $document.bind('pageSearchReady', function() {
// moved from tiki-list_file_gallery.tpl in tiki 6
function checkClose() {
if (!$("#keepOpenCbx").attr("checked")) {
if (!$("#keepOpenCbx").prop("checked")) {
window.close();
} else {
window.blur();
......@@ -1302,7 +1302,7 @@ function dialogExternalLinkOpen( area_id ) {
$("#tbLinkDesc").val(m[2]);
if (m[3]) {
if ($("#tbLinkNoCache") && m[3] == "nocache") {
$("#tbLinkNoCache").attr("checked", "checked");
$("#tbLinkNoCache").prop("checked", "checked");
} else {
$("#tbLinkRel").val(m[3]);
}
......@@ -1330,7 +1330,7 @@ function dialogExternalLinkInsert(area_id, dialog) {
if ($("#tbLinkRel").val()) {
s += "|" + $("#tbLinkRel").val();
}
if ($("#tbLinkNoCache") && $("#tbLinkNoCache").attr("checked")) {
if ($("#tbLinkNoCache") && $("#tbLinkNoCache").prop("checked")) {
s += "|nocache";
}
s += "]";
......@@ -1507,7 +1507,7 @@ function dialogFindFind( area_id ) {
var s, opt, str, re, p = 0, m;
s = findInput.val();
opt = "";
if ($("#tbFindCase").attr("checked")) {
if ($("#tbFindCase").prop("checked")) {
opt += "i";
}
str = ta.val();
......@@ -1546,10 +1546,10 @@ function dialogReplaceReplace( area_id ) {
var s = findInput.val();
var r = $("#tbReplaceReplace").val();
var opt = "";
if ($("#tbReplaceAll").attr("checked")) {
if ($("#tbReplaceAll").prop("checked")) {
opt += "g";
}
if ($("#tbReplaceCase").attr("checked")) {
if ($("#tbReplaceCase").prop("checked")) {
opt += "i";
}
var ta = $('#' + area_id);
......
......@@ -102,13 +102,13 @@ function initThemeGenDialog() { // closure for colorpicker code
// checkboxes to select items
$(".tgItems :checkbox").click(function (e, flip) {
if (flip) {
if (!$(this).attr("checked")) { // flip trickery to get trigger to toggle the right classes
if (!$(this).prop("checked")) { // flip trickery to get trigger to toggle the right classes
$(this).parent().addClass("selected");
} else {
$(this).parent().removeClass("selected");
}
} else {
if ($(this).attr("checked")) { // flip trickery to get trigger to toggle the right classes
if ($(this).prop("checked")) { // flip trickery to get trigger to toggle the right classes
$(this).parent().addClass("selected");
} else {
$(this).parent().removeClass("selected");
......@@ -256,7 +256,7 @@ function initThemeGenDialog() { // closure for colorpicker code
// // disable for now
// $("input[type=checkbox].tgLivePreview", "#tg_section_typography")
// .attr("checked", "")
// .prop("checked", "")
// .attr("disabled", "disabled");
$("label", "#themegenerator_container").each(function () { // labels go 100% width in dialog
......
......@@ -130,7 +130,7 @@
var addCheckbox = function (name) {
$row.append($('<td class="checkbox"/>').append(
$('<input type="checkbox" name="field~' + field.fieldId + '~' + name + '" value="1"/>')
.attr('checked', field[name] === 'y')
.prop('checked', field[name] === 'y')
));
};
......
......@@ -20,10 +20,10 @@
.attr('name', 'groups~' + name + '~name')
.val("{group} " + name)
.parent().show();
$('.managingGroup', item).attr('checked', false);
$('.managingGroup', item).prop('checked', false);
$('.autojoin', item)
.attr('name', 'groups~' + name + '~autojoin')
.attr('checked', false);
.prop('checked', false);
$('.permissions', item)
.attr('name', 'groups~' + name + '~permissions')
.val('');
......
......@@ -37,7 +37,7 @@ var canTranslateIt = function( e ) {
var interTransDeepestElement = -1;
$("#intertrans-active").click( function( e ) {
if (interTransDone && !$(this).attr("checked")) {
if (interTransDone && !$(this).prop("checked")) {
history.go(0);
}
});
......
......@@ -240,7 +240,7 @@ $("#'.$id.'_openall").click( function () {
$headerlib->add_jq_onready(
'
$("#'.$id.'_showSelected").click( function () {
if (!$(this).attr("checked")) {
if (!$(this).prop("checked")) {
$("#treetable_1 tr td.checkBoxCell input:checkbox").parent().parent().show()
} else {
$("#treetable_1 tr td.checkBoxCell input:checkbox").parent().parent().hide()
......
......@@ -126,7 +126,7 @@
}
},
close: function () {
$(':checked', this).attr('checked', false);
$(':checked', this).prop('checked', false);
}
});
......@@ -165,7 +165,7 @@
}
},
close: function () {
$(':checked', this).attr('checked', false);
$(':checked', this).prop('checked', false);
}
});
......
......@@ -53,7 +53,7 @@
var label, checkbox;
optionalLayers.append(label = $('<label/>').text(thisLayer.name).prepend(
checkbox = $('<input type="checkbox"/>')
.attr('checked', thisLayer.getVisibility())));
.prop('checked', thisLayer.getVisibility())));
checkbox.change(function (e) {
thisLayer.setVisibility($(this).is(':checked'));
});
......
......@@ -12,13 +12,13 @@
</div>
{include file="prefs/shared-dependencies.tpl"}
{jq}
if( ! $('#{{$p.id|escape}}').attr('checked') || $('#{{$p.id|escape}}').attr('disabled') ) {
if( ! $('#{{$p.id|escape}}').prop('checked') || $('#{{$p.id|escape}}').attr('disabled') ) {
$('#{{$p.preference|escape}}_childcontainer').hide();
}
if ($('#{{$p.preference|escape}}_childcontainer').length) {
$('#{{$p.id|escape}}').change( function() {
var id = '{{$p.preference|escape}}_childcontainer';
if( $('#{{$p.id|escape}}').attr('checked') || $('#{{$p.id|escape}}').attr('disabled') ) {
if( $('#{{$p.id|escape}}').prop('checked') || $('#{{$p.id|escape}}').attr('disabled') ) {
{{if $mode eq 'invert'}}hide(id);{{else}}show(id);{{/if}}
} else {
{{if $mode eq 'invert'}}show(id);{{else}}hide(id);{{/if}}
......
......@@ -21,11 +21,11 @@
{foreach from=$p.options key=value item=label name=loop}
{jq}
if( ! $('#{{$p.id|cat:'_'|cat:$smarty.foreach.loop.index|escape}}').attr('checked') ) {
if( ! $('#{{$p.id|cat:'_'|cat:$smarty.foreach.loop.index|escape}}').prop('checked') ) {
$('#{{$p.preference|escape}}_childcontainer_{{$smarty.foreach.loop.index}}').hide();
}
$('#{{$p.id|cat:'_'|cat:$smarty.foreach.loop.index|escape}}').change( function() {
if( $('#{{$p.id|cat:'_'|cat:$smarty.foreach.loop.index|escape}}').attr('checked') ) {
if( $('#{{$p.id|cat:'_'|cat:$smarty.foreach.loop.index|escape}}').prop('checked') ) {
show('#{{$p.preference|escape}}_childcontainer_{{$smarty.foreach.loop.index}}');
}
} );
......
......@@ -31,13 +31,13 @@
{jq}
$('.pref-reset')
.change( function() {
var c = $(this).attr('checked') === "checked";
var c = $(this).prop('checked') === "checked";
var $el = $(this).closest('.adminoptionbox').find('input:not(:hidden),select,textarea')
.not('.system').attr( 'disabled', c )
.css("opacity", c ? .6 : 1 );
var defval = $("#" + $(this).val() + "_default").val();
if ($el.attr("type") == "checkbox") {
$el.attr('checked', defval === "y" ? c : !c);
$el.prop('checked', defval === "y" ? c : !c);
} else {
var temp = $("[name=" + $(this).val() + "]").val();
$el.val( defval );
......@@ -51,7 +51,7 @@ $('.pref-reset')
.find('a')
.click( function() {
var box = $(this).closest('span').find(':checkbox');
box.attr('checked', box.filter(':checked').length == 0).change();
box.prop('checked', box.filter(':checked').length == 0).change();
var $i = $(this).find("img");
if ($i.attr("src").indexOf("undo") > -1) {
$i.attr({
......
......@@ -383,7 +383,7 @@
</form>
{jq}
$("#module_list_show_all").click(function(){
$("#module_list li.disabled").toggle($(this).attr("checked"));
$("#module_list li.disabled").toggle($(this).prop("checked"));
});
{/jq}
{/tab}
......
......@@ -50,7 +50,7 @@
{jq}
var blocks = $('#transition-group-selection, #transition-category-selection');
$(':radio[name=transition_mode]').change( function( e ) {
if( $(this).attr('checked') ) {
if( $(this).prop('checked') ) {
blocks.hide();
blocks.filter( '#transition-' + $(this).val() + '-selection' ).show();
}
......
......@@ -94,11 +94,11 @@ $('.object-list :checkbox').change(function () {
$('.object-list li:not(.available) :checkbox').attr('disabled', true);
$('.select-all').click(function () {
$('.object-list :unchecked').attr('checked', true).change();
$('.object-list :unchecked').prop('checked', true).change();
return false;
});
$('.unselect-all').click(function () {
$('.object-list :checked').attr('checked', false).change();
$('.object-list :checked').prop('checked', false).change();
return false;
});
{/jq}
......@@ -79,7 +79,7 @@
<label for="propagate_category">{tr}Assign or remove permissions on <em>all</em> child categories{/tr}</label>
</p>
{jq}$("input[name='assign'],input[name='remove']").click(function(){
if ($("#propagate_category").attr("checked")) {
if ($("#propagate_category").prop("checked")) {
return confirm("{tr}Are you sure you want to affect all child categories?\nThere is no undo.{/tr}");
} }); {/jq}
{/if}
......@@ -88,7 +88,7 @@ if ($("#propagate_category").attr("checked")) {
<input name="assignstructure" id="assignstructure" type="checkbox">
<label for="assignstructure">{tr}Assign or remove permissions on all pages of the sub-structure{/tr}</label>
{jq}$("input[name='assign'],input[name='remove']").click(function(){
if ($("#assignstructure").attr("checked")) {
if ($("#assignstructure").prop("checked")) {
return confirm("{tr}Are you sure you want to affect all pages in this sub-structure?\nThere is no undo.{/tr}");
} }); {/jq}
{/if}
......
......@@ -184,7 +184,7 @@ $headerlib->add_jq_onready(
if (!InvoiceTaxable.is(':checked')) {
InvoiceTaxable
.val('n')
.attr('checked', 'true');
.prop('checked', 'true');
}
});
......
......@@ -475,7 +475,7 @@ JS;
if (\$(this).is(':checked')) {
\$('input[value="'+\$(this).val()+'"]'). // other checkboxes of same value (perm)
filter('$beneficiaries'). // which inherit from this
attr('checked',\$(this).is(':checked')). // check and disable
prop('checked',\$(this).is(':checked')). // check and disable
attr('disabled',\$(this).is(':checked'));
}
......@@ -484,12 +484,12 @@ JS;
if (\$(this).is(':checked')) {
\$('input[value="'+\$(this).val()+'"]'). // same...
filter('$beneficiaries').
attr('checked',true). // check?
prop('checked',true). // check?
attr('disabled',true); // disable
} else {
\$('input[value="'+\$(this).val()+'"]'). // same...
filter('$beneficiaries').
attr('checked',false). // check?
prop('checked',false). // check?
attr('disabled',false); // disable
}
});
......
......@@ -407,8 +407,8 @@ if (\$("input[name=newver][checked=checked]").length) {
\$("input[name=newver][checked=checked]").change();
\$("input[name=oldver][checked=checked]").change();
} else if ($not_comparing) {
\$("input[name=newver]:eq(0)").attr("checked", "checked").change();
\$("input[name=oldver]:eq(1)").attr("checked", "checked").change();
\$("input[name=newver]:eq(0)").prop("checked", "checked").change();
\$("input[name=oldver]:eq(1)").prop("checked", "checked").change();
}
JS
);
......
......@@ -212,7 +212,7 @@ $headerlib->add_jq_onready(
});
window.checkAll = function() {
designer.find(".fieldPicker").find("input").attr("checked", "true");
designer.find(".fieldPicker").find("input").prop("checked", "true");
};
window.uncheckAll = function() {
......
......@@ -561,18 +561,18 @@ if ($_REQUEST['locSection'] == 'settings') {
// set port for imap
\$('[name=imap]').change(function() {
if (\$('[name=imap]').val()) {
\$('[name=port]').val(\$('[name=useSSL]').attr('checked')? '993' : '143');
\$('[name=port]').val(\$('[name=useSSL]').prop('checked')? '993' : '143');
}
});
// set port for pop
\$('[name=pop]').change(function() {
if (\$('[name=pop]').val() && !\$('[name=imap]').val()) {
\$('[name=port]').val(\$('[name=useSSL]').attr('checked')? '995' : '110');
\$('[name=port]').val(\$('[name=useSSL]').prop('checked')? '995' : '110');
}
});
// set ports for ssl
\$('[name=useSSL]').change(function(v,a) {
if (\$('[name=useSSL]').attr('checked')) {
if (\$('[name=useSSL]').prop('checked')) {
\$('[name=port]').val(\$('[name=imap]').val() ? '993' : '995');
\$('[name=smtpPort]').val('465');
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment