Merge "DI: Make pinnable elements work on Safari 13 and earlier"

This commit is contained in:
jenkins-bot 2023-01-23 18:12:42 +00:00 committed by Gerrit Code Review
commit f25eccaac7

View file

@ -129,7 +129,13 @@ function bindPinnableToggleButtons( header ) {
// Check the breakpoint in case an override is needed on pageload. // Check the breakpoint in case an override is needed on pageload.
disablePinningAtBreakpoint( header, pinnableBreakpoint ); disablePinningAtBreakpoint( header, pinnableBreakpoint );
// Add match media handler. // Add match media handler.
pinnableBreakpoint.addEventListener( 'change', disablePinningAtBreakpoint.bind( null, header ) ); if ( pinnableBreakpoint.addEventListener ) {
pinnableBreakpoint.addEventListener( 'change', disablePinningAtBreakpoint.bind( null, header ) );
} else {
// Before Safari 14, MediaQueryList is based on EventTarget,
// so you must use addListener() and removeListener() to observe media query lists.
pinnableBreakpoint.addListener( disablePinningAtBreakpoint.bind( null, header ) );
}
} }
/** /**