jQuery alter .bind()/.unbind() to .on()/.off()

Bug #1651911 reported by Robert Lyon on 2016-12-22
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Medium
Alexey Omelchenko

Bug Description

There are a few things to be deprecated in jQuery 3.0 http://api.jquery.com/category/deprecated/deprecated-3.0/

The main one for us is the .bind() / .unbind() they should be changed to .on() / .off()

See these lines that need fixing up
htdocs/js/formchangechecker.js:148: jQuery('form#' + self.id + ' :input').bind('change.changechecker', function() {
htdocs/js/formchangechecker.js:158: jQuery('form#' + self.id + ' :input[type="radio"]').bind('click.changechecker', function() {
htdocs/js/formchangechecker.js:161: jQuery('form#' + self.id + ' :input.cancel').bind('click.changechecker', function() {
htdocs/js/formchangechecker.js:164: jQuery('form#' + self.id + ' :input.submit').bind('click.changechecker', function() {
htdocs/js/formchangechecker.js:167: jQuery('form#' + self.id + ' :input[type="file"]').bind('change.changechecker', function() {
htdocs/js/formchangechecker.js:170: jQuery('form#' + self.id).bind('submit.changechecker', function() {
htdocs/js/formchangechecker.js:178: jQuery('form#' + self.id + ' :input').unbind('change.changechecker');
htdocs/js/formchangechecker.js:179: jQuery('form#' + self.id + ' :input[type="radio"]').unbind('click.changechecker');
htdocs/js/formchangechecker.js:180: jQuery('form#' + self.id + ' :input.cancel').unbind('click.changechecker');
htdocs/js/formchangechecker.js:181: jQuery('form#' + self.id).unbind('submit.changechecker');

htdocs/js/adminadduser.js:93: $(this).on('focus', move_step.bind(null, this));
htdocs/js/adminadduser.js:94: $(this).on('click', move_step.bind(null, this));
htdocs/js/adminadduser.js:99: $(select).on('change', change_quota.bind(null, select));

htdocs/lib/form/elements/authlist.php:85: jQuery('form[name=' + form.data.name + ']').find('select#dummySelect').unbind('change.changechecker');

htdocs/lib/pieforms/pieform/elements/calendar.php:289: prevYrBtn.unbind("click").bind("click", function() {
htdocs/lib/pieforms/pieform/elements/calendar.php:294: nextYrBtn.unbind("click").bind("click", function() {

There are a bunch of thirdparty plugins using .bind() / .unbind() such as:
-TinyMCE
-Select2
-jQuery-ui
-Mochikit (which we are removing)
-filezone
-videojs
-pdfjs
-slimbox2

we should see if they have an updated version that use .on/.off rather than .bind/.unbind etc rather than fixing them locally.

Robert Lyon (robertl-9) on 2016-12-22
summary: - juery things to be deprecated in 3.0
+ juery things deprecated in 3.0
Robert Lyon (robertl-9) on 2016-12-22
description: updated
summary: - juery things deprecated in 3.0
+ jQuery things deprecated in 3.0
Changed in mahara:
milestone: none → 17.04.0
importance: Undecided → Medium
assignee: nobody → Alexey Omelchenko (alexeyomelchenko)
status: New → Confirmed
Robert Lyon (robertl-9) on 2017-02-26
summary: - jQuery things deprecated in 3.0
+ jQuery alter .bind()/.unbind() to .on()/.off()
Changed in mahara:
status: Confirmed → Fix Committed
Robert Lyon (robertl-9) on 2017-04-27
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers