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.
pull/2/head
Raymond Hill 4 years ago
parent e0800f89df
commit 57eb9fc150
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

@ -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…
Cancel
Save