Skip to content

Commit f919ea6

Browse files
authored
Merge pull request #774 from pressbooks/pbb-751-jQueryUpgrade
Fix jQuery deprecation warnings
2 parents 6c383d6 + ce3725b commit f919ea6

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

.github/workflows/.pipeline.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ jobs:
1313
matrix:
1414
php: [ 7.3 ]
1515
os: [ ubuntu-18.04 ]
16-
wordpress: [ 5.6.2 ]
16+
wordpress: [ 5.6.2, 5.7.2 ]
1717

18-
name: Test - PHP ${{ matrix.php }}
18+
name: Test - PHP ${{ matrix.php }} - WP ${{ matrix.wordpress }}
1919

2020
env:
2121
WP_VERSION: ${{ matrix.wordpress }}

assets/src/scripts/routes/common.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export default {
7777
let $svgArrow = jQuery( 'button[aria-expanded] > svg' );
7878
let $toggleButton = jQuery( 'button[aria-expanded]' );
7979

80-
jQuery( $toggleButton, $svgArrow ).click( function ( e ) {
80+
jQuery( $toggleButton, $svgArrow ).on( 'click', function ( e ) {
8181
// Cast the state as a boolean
8282
let expanded = btn.getAttribute( 'aria-expanded' ) === 'true' || false;
8383

@@ -173,7 +173,7 @@ export default {
173173
$( '#h5p-show-hide' ).text( $( '#h5p-show-hide' ).attr( 'show-all-text' ) );
174174
$( '.h5p-row-item' ).text( $( '.h5p-row-item' ).attr( 'show-activity-text' ) );
175175

176-
$h5pActivities.click( function () {
176+
$h5pActivities.on( 'click', function () {
177177
if ( $( this ).text() === $( this ).attr( 'show-activity-text' ) ) {
178178
$activityContainer.hide();
179179
$( this ).closest( 'tr' ).next( this ).show( 'slow' );
@@ -185,7 +185,7 @@ export default {
185185
}
186186
} );
187187

188-
$( '#h5p-show-hide' ).click( function () {
188+
$( '#h5p-show-hide' ).on( 'click', function () {
189189
if ( $( this ).text() === $( this ).attr( 'show-all-text' ) ) {
190190
$activityContainer.show();
191191
$( this ).text( $( this ).attr( 'hide-all-text' ) );

assets/src/scripts/routes/home.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default {
1818
.find(
1919
'ol'
2020
)
21-
.removeAttr( 'hidden' );
21+
.prop( 'hidden', false );
2222
} );
2323
$target.parents( '.toc__toggle' ).attr( 'aria-expanded', 'true' );
2424
} );

assets/src/scripts/routes/single.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export default {
33
// Javascript to be fired on single reading view
44
jQuery( $ => {
55
let toggle = $( '.block-reading-meta__compare__toggle' );
6-
toggle.click( event => {
6+
toggle.on( 'click', event => {
77
let activity = $( '.block-reading-meta__compare__activity' );
88
let alert = $( '.alert' );
99
let container = $( '.block-reading-meta__compare__comparison' );
@@ -12,9 +12,9 @@ export default {
1212
alert.addClass( 'visually-hidden' );
1313
if ( $( event.currentTarget ).attr( 'aria-expanded' ) === 'false' ) {
1414
toggle.attr( 'aria-expanded', true );
15-
activity.removeAttr( 'hidden' );
15+
activity.prop( 'hidden', false );
1616
if ( container.hasClass( 'populated' ) ) {
17-
container.removeAttr( 'hidden' );
17+
container.prop( 'hidden', false );
1818
activity.attr( 'hidden', true );
1919
} else {
2020
alert.text( pressbooksBook.comparison_loading );
@@ -54,7 +54,7 @@ export default {
5454
.text( deletions );
5555
activity.attr( 'hidden', true );
5656
alert.text( pressbooksBook.comparison_loaded );
57-
container.removeAttr( 'hidden' );
57+
container.prop( 'hidden', false );
5858
}
5959
});
6060
} );
@@ -78,7 +78,7 @@ export default {
7878
const offset = 250;
7979
const duration = 0;
8080

81-
$( window ).scroll( function () {
81+
$( window ).on( 'scroll', function () {
8282
if ( $( window ).scrollTop() > offset ) {
8383
$( '.nav-reading__up' ).animate( { opacity: 1 }, duration );
8484
}
@@ -87,7 +87,7 @@ export default {
8787
}
8888
} );
8989

90-
$( '.nav-reading__up' ).click( function ( event ) {
90+
$( '.nav-reading__up' ).on( 'click', function ( event ) {
9191
event.preventDefault();
9292
$( '.nav-reading__up' )
9393
.blur()
@@ -96,7 +96,7 @@ export default {
9696
return false;
9797
} );
9898

99-
$( document ).keydown( function ( e ) {
99+
$( document ).on( 'keydown', function ( e ) {
100100
if ( $( 'body' ).hasClass( 'no-navigation' ) ) {
101101
return;
102102
}
@@ -124,15 +124,15 @@ export default {
124124
.removeAttr( 'width' );
125125
} );
126126

127-
$( window ).resize( function () {
127+
$( window ).on( 'resize', function () {
128128
$allVideos.each( function () {
129129
let $el = $( this );
130130
let newWidth = $el.parent().parent().width();
131131
$el
132132
.width( newWidth )
133133
.height( newWidth * $el.data( 'aspectRatio' ) );
134134
} );
135-
} ).resize();
135+
} ).trigger( 'resize' );
136136
} )();
137137
} );
138138
} );

dist/mix-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"/scripts/book.js": "/scripts/book.js?id=209ba93d22103a35854d",
2+
"/scripts/book.js": "/scripts/book.js?id=af07185482a38384a7bf",
33
"/styles/book.css": "/styles/book.css?id=3cbb775c3b4e63c64468",
44
"/styles/web-house-style.css": "/styles/web-house-style.css?id=d3c1aedc7525b0f30ccd",
55
"/scripts/collapse-sections.js": "/scripts/collapse-sections.js?id=ba8eb815cea5fd273013",

0 commit comments

Comments
 (0)