1
0
Fork 0
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:
Raymond Hill 2020-03-08 11:12:47 -04:00
parent e0800f89df
commit 57eb9fc150
No known key found for this signature in database
GPG key ID: 25E1490B761470C2

View file

@ -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; }