Skip to content

Commit 07fdb1f

Browse files
committedJul 19, 2011
Use .prop() instead of .attr() with jQuery
jQuery 1.6 introduced the .prop() method which replaces .attr() for numerous cases. Using .prop() solves a number of issues experienced by browsers when rendering with application/xhtml+xml MIME type. Full information on why this change is necessary and the details of .prop() and .attr() can be found at: http://blog.jquery.com/2011/05/12/jquery-1-6-1-released/
1 parent e8602a3 commit 07fdb1f

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed
 

‎javascript/common.js

+16-16
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@ $(document).ready( function() {
105105
var checkedCount = $(this).closest('form').find(':checkbox[name="' + fieldName + '[]"]:checked').length;
106106
var totalCount = $(this).closest('form').find(':checkbox[name="' + fieldName + '[]"]').length;
107107
var allSelected = checkedCount == totalCount;
108-
$(this).closest('form').find(':checkbox[name=' + fieldName + '_all]').attr('checked', allSelected);
108+
$(this).closest('form').find(':checkbox[name=' + fieldName + '_all]').prop('checked', allSelected);
109109
});
110110
$(':checkbox.check_all').click(function() {
111111
var baseFieldName = $(this).attr('name').replace(/_all$/, '');
112-
$(this).closest('form').find(':checkbox[name="' + baseFieldName + '[]"]').attr('checked', $(this).is(':checked'));
112+
$(this).closest('form').find(':checkbox[name="' + baseFieldName + '[]"]').prop('checked', $(this).is(':checked'));
113113
});
114114
}
115115

@@ -207,30 +207,30 @@ $(document).ready( function() {
207207

208208
$('input[type=checkbox]#use_date_filters').live('click', function() {
209209
if (!$(this).is(':checked')) {
210-
$('div.filter-box select[name=start_year]').attr('disabled', 'disabled');
211-
$('div.filter-box select[name=start_month]').attr('disabled', 'disabled');
212-
$('div.filter-box select[name=start_day]').attr('disabled', 'disabled');
213-
$('div.filter-box select[name=end_year]').attr('disabled', 'disabled');
214-
$('div.filter-box select[name=end_month]').attr('disabled', 'disabled');
215-
$('div.filter-box select[name=end_day]').attr('disabled', 'disabled');
210+
$('div.filter-box select[name=start_year]').prop('disabled', true);
211+
$('div.filter-box select[name=start_month]').prop('disabled', true);
212+
$('div.filter-box select[name=start_day]').prop('disabled', true);
213+
$('div.filter-box select[name=end_year]').prop('disabled', true);
214+
$('div.filter-box select[name=end_month]').prop('disabled', true);
215+
$('div.filter-box select[name=end_day]').prop('disabled', true);
216216
} else {
217-
$('div.filter-box select[name=start_year]').removeAttr('disabled');
218-
$('div.filter-box select[name=start_month]').removeAttr('disabled');
219-
$('div.filter-box select[name=start_day]').removeAttr('disabled');
220-
$('div.filter-box select[name=end_year]').removeAttr('disabled');
221-
$('div.filter-box select[name=end_month]').removeAttr('disabled');
222-
$('div.filter-box select[name=end_day]').removeAttr('disabled');
217+
$('div.filter-box select[name=start_year]').prop('disabled', false);
218+
$('div.filter-box select[name=start_month]').prop('disabled', false);
219+
$('div.filter-box select[name=start_day]').prop('disabled', false);
220+
$('div.filter-box select[name=end_year]').prop('disabled', false);
221+
$('div.filter-box select[name=end_month]').prop('disabled', false);
222+
$('div.filter-box select[name=end_day]').prop('disabled', false);
223223
}
224224
});
225225

226226
/* For Period.php bundled with the core MantisGraph plugin */
227227
$('#dates > input[type=image].datetime').hide();
228228
$('#period_menu > select#interval').change(function() {
229229
if ($(this).val() == 10) {
230-
$('#dates > input[type=text].datetime').removeAttr('disabled');
230+
$('#dates > input[type=text].datetime').prop('disabled', false);
231231
$('#dates > input[type=image].datetime').show();
232232
} else {
233-
$('#dates > input[type=text].datetime').attr('disabled', 'disabled');
233+
$('#dates > input[type=text].datetime').prop('disabled', true);
234234
$('#dates > input[type=image].datetime').hide();
235235
}
236236
});

0 commit comments

Comments
 (0)