private-face / jquery.fullscreen

jQuery plugin for opening page elements in fullscreen mode.
MIT License
148 stars 83 forks source link

Cannot read property 'style' of null #40

Open Fr1ar opened 6 years ago

Fr1ar commented 6 years ago

On closing the fullscreen a JavaScript error is thrown, caused by the empty variable this._fullScreenElement.

User agents: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.137 YaBrowser/17.4.1.1026 Yowser/2.5 Safari/537.36

Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36 OPR/36.0.2130.80 Call stack:

Uncaught Error: Cannot read property 'style' of null
at _revertStyles
at _fullScreenChange
at map
at handlers
at add

Problem method:

_revertStyles: function() {
    var $elem = $(this._fullScreenElement);
    for (var property in this.__options.styles) {
                // ############## this._fullScreenElement IS NULL HERE ###################
        this._fullScreenElement.style[property] = this.__savedStyles[property];
    }
    if ($elem.is('body')) {
        // in order to manipulate scrollbar of BODY in Chrome/OPR
        // you have to change 'overflow' property HTML element
        document.documentElement.style.overflow = this.__savedStyles.overflow;
    }
    if (this.__options.toggleClass) {
        $elem.removeClass(this.__options.toggleClass);
    }
}

We're using jquery.fullscreen.min.js 0.6.0 and jQuery 3.2.1

private-face commented 6 years ago

@Fr1ar Could you share a specific code sample where it fails? I could not reproduce it on Opera and Yandex browsers. Could you also check if example/index.html works well on your setup?

Fr1ar commented 6 years ago

Unfortunately I can't reproduce this problem on my PC, I just receive many similar error reports from our clients.