mirror of
https://github.com/gorhill/uMatrix.git
synced 2024-05-05 21:03:17 +12:00
Expect that IntersectionObserver API may not be available
Related issue: - https://github.com/uBlockOrigin/uMatrix-issues/issues/235 The popup-resize functionality won't be available if the IntersectionObserver API is not available. The purpose of the popup-resize code is to adjust the matrix visuals on small display -- i.e. on mobile or when the popup panel is used in the overflow menu in Firefox.
This commit is contained in:
parent
e0800f89df
commit
57eb9fc150
|
@ -77,6 +77,11 @@ const resizePopup = (( ) => {
|
|||
|
||||
// The purpose of `xobserver` is to initiate the resize handler only
|
||||
// when the popup panel is actually visible.
|
||||
|
||||
// https://github.com/uBlockOrigin/uMatrix-issues/issues/235
|
||||
if ( self.IntersectionObserver instanceof Object === false ) {
|
||||
return ( ) => { };
|
||||
}
|
||||
let xobserver = new IntersectionObserver(intersections => {
|
||||
if ( intersections.length === 0 ) { return; }
|
||||
if ( intersections[0].isIntersecting === false ) { return; }
|
||||
|
|
Loading…
Reference in a new issue