Skip to content

Commit

Permalink
Fix: Fix jQuery deprecation notices of bind() in the browser console
Browse files Browse the repository at this point in the history
```
JQMIGRATE: jQuery.fn.bind() is deprecated
```
  • Loading branch information
michaeluno committed Jul 6, 2021
1 parent be68a04 commit 178d538
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
Expand Up @@ -55,7 +55,7 @@ static public function getScript( /* $oMsg */ ) {
* Gets triggered when a widget of the framework is saved.
* @since 3.7.0
*/
jQuery( document ).bind( 'admin-page-framework_saved_widget', function( event, oWidget ){
jQuery( document ).on( 'admin-page-framework_saved_widget', function( event, oWidget ){
jQuery( oWidget ).initializeAdminPageFrameworkCollapsibleSections();
});
Expand Down
Expand Up @@ -77,7 +77,7 @@ static public function getScript( /* $oMsg */ ) {
* Gets triggered when a widget of the framework is saved.
* @since 3.7.0
*/
$( document ).bind( 'admin-page-framework_saved_widget', function( event, oWidget ){
$( document ).on( 'admin-page-framework_saved_widget', function( event, oWidget ){
jQuery( '.admin-page-framework-form-loading' ).remove();
});
Expand Down
Expand Up @@ -46,7 +46,7 @@ static public function getScript( /* $oMsg */ ) {
/**
* Gets triggered when the + (add) button of a repeatable field is pressed.
*/
$( document ).bind( 'admin-page-framework_added_repeatable_field', function( oEvent, sFieldType, sID, iCallType, iSectionIndex, iFieldIndex ){
$( document ).on( 'admin-page-framework_added_repeatable_field', function( oEvent, sFieldType, sID, iCallType, iSectionIndex, iFieldIndex ){
var _oThisNode = jQuery( oEvent.target );
$.each( $.fn.aAdminPageFrameworkAddRepeatableFieldCallbacks, function( iIndex, aCallback ) {
var _hfCallback = aCallback[ 0 ];
Expand Down Expand Up @@ -79,7 +79,7 @@ static public function getScript( /* $oMsg */ ) {
* @param iCallType 0: repeated field, 1: repeated section.
* @param oModelContainer The container that has data of model strings to generate incremented IDs and names.
*/
$( document ).bind( 'admin-page-framework_repeated_field', function( oEvent, iCallType, oModelContainer ){
$( document ).on( 'admin-page-framework_repeated_field', function( oEvent, iCallType, oModelContainer ){
var _oThis = jQuery( oEvent.target );
var sFieldType = $( oEvent.target ).data( 'type' );
Expand Down Expand Up @@ -135,7 +135,7 @@ static public function getScript( /* $oMsg */ ) {
* Gets triggered when sorting sections stops.
* @since 3.8.0
*/
$( document ).bind( 'admin-page-framework_stopped_sorting_sections', function( oEvent ){
$( document ).on( 'admin-page-framework_stopped_sorting_sections', function( oEvent ){
var _oThisNode = jQuery( oEvent.target );
$.each( $.fn.aAdminPageFrameworkStoppedSortingSectionsCallbacks, function( iIndex, aCallback ) {
Expand All @@ -153,7 +153,7 @@ static public function getScript( /* $oMsg */ ) {
* Supposed to get triggered when a repeatable field remove button is pressed.
* @remark Currently not used.
*/
/* $( document ).bind( 'admin-page-framework_removed_field', function( oEvent, sFieldType, sID, iCallType, iSectionIndex, iFieldIndex ){
/* $( document ).on( 'admin-page-framework_removed_field', function( oEvent, sFieldType, sID, iCallType, iSectionIndex, iFieldIndex ){
var _oThisNode = jQuery( oEvent.target );
$.each( $.fn.aAdminPageFrameworkRemoveRepeatableFieldCallbacks, function( iIndex, aCallback ) {
var _hfCallback = aCallback[ 0 ];
Expand Down Expand Up @@ -207,7 +207,7 @@ static public function getScript( /* $oMsg */ ) {
* Gets triggered when a widget of the framework is saved.
* @since 3.2.0
*/
$( document ).bind( 'admin-page-framework_saved_widget', function( event, oWidget ){
$( document ).on( 'admin-page-framework_saved_widget', function( event, oWidget ){
$.each( $.fn.aAdminPageFrameworkAddedWidgetCallbacks, function( iIndex, aCallback ) {
var _hfCallback = aCallback[ 0 ];
var _aFieldTypes = aCallback[ 1 ];
Expand Down
Expand Up @@ -60,14 +60,14 @@ static public function getScript( /* $oMsg */ ) {
);
// Callback the registered functions.
_oSortable.bind( 'sortstop', function() {
_oSortable.on( 'sortstop', function() {
$( this ).callBackStoppedSortingFields(
$( this ).data( 'type' ),
$( this ).attr( 'id' ),
0 // call type 0: fields, 1: sections
);
});
_oSortable.bind( 'sortupdate', function() {
_oSortable.on( 'sortupdate', function() {
$( this ).callBackSortedFields(
$( this ).data( 'type' ),
$( this ).attr( 'id' ),
Expand Down
Expand Up @@ -77,7 +77,7 @@ static public function getScript( /* $oMsg */ ) {
if ( ! _bIsTabbed ) {
_oSortable.bind( 'sortstop', function() {
_oSortable.on( 'sortstop', function() {
jQuery( this ).find( 'caption > .admin-page-framework-section-title:not(.admin-page-framework-collapsible-sections-title,.admin-page-framework-collapsible-section-title)' ).first().show();
jQuery( this ).find( 'caption > .admin-page-framework-section-title:not(.admin-page-framework-collapsible-sections-title,.admin-page-framework-collapsible-section-title)' ).not( ':first' ).hide();
Expand Down

0 comments on commit 178d538

Please sign in to comment.