Skip to content

Commit

Permalink
fix: protect against missing addEventListener on MediaQueryList (#4635)
Browse files Browse the repository at this point in the history
  • Loading branch information
dlockhart authored Apr 30, 2024
1 parent 5aaf243 commit 3e4a6a4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions components/scroll-wrapper/scroll-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,13 @@ class ScrollWrapper extends RtlMixin(LitElement) {

connectedCallback() {
super.connectedCallback();
PRINT_MEDIA_QUERY_LIST?.addEventListener('change', this._handlePrintChange);
PRINT_MEDIA_QUERY_LIST.addEventListener?.('change', this._handlePrintChange);
}

disconnectedCallback() {
super.disconnectedCallback();
this._disconnectAll();
PRINT_MEDIA_QUERY_LIST?.removeEventListener('change', this._handlePrintChange);
PRINT_MEDIA_QUERY_LIST.removeEventListener?.('change', this._handlePrintChange);
}

firstUpdated(changedProperties) {
Expand Down

0 comments on commit 3e4a6a4

Please sign in to comment.