Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Cannot set property 'defaultOpts' of undefined #297

Open
Richard87 opened this issue Jun 4, 2018 · 1 comment
Open

Error: Cannot set property 'defaultOpts' of undefined #297

Richard87 opened this issue Jun 4, 2018 · 1 comment

Comments

@Richard87
Copy link

Richard87 commented Jun 4, 2018

Hi! Any idea what this is all about, I just noticed it now:

Cannot set property 'defaultOpts' of undefined at outdatedBrowser (outdatedbrowser.js:14)

My initializing code:

function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload !== 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            if (oldonload) {
                oldonload();
            }
            func();
        }
    }
}
//call plugin function after DOM ready
addLoadEvent(function(){
    outdatedBrowser({
        bgColor: '#f25648',
        color: '#ffffff',
        lowerThan: 'borderImage',
        languagePath: ''
    })
});
@KennethJoris
Copy link

KennethJoris commented Oct 27, 2018

FIX: Declair 'defaultOpts' as a variable.

Code changes:

`
// Default settings
var defaultOpts = {
bgColor: '#f25648',
color: '#ffffff',
lowerThan: 'transform',
languagePath: '../outdatedbrowser/lang/en.html'
};

if (options) {
    //assign css3 property or js property to IE browser version
    if (options.lowerThan == 'IE8' || options.lowerThan == 'borderSpacing') {
        options.lowerThan = 'borderSpacing';
    } else if (options.lowerThan == 'IE9' || options.lowerThan == 'boxShadow') {
        options.lowerThan = 'boxShadow';
    } else if (options.lowerThan == 'IE10' || options.lowerThan == 'transform' || options.lowerThan == '' || typeof options.lowerThan === "undefined") {
        options.lowerThan = 'transform';
    } else if (options.lowerThan == 'IE11' || options.lowerThan == 'borderImage') {
        options.lowerThan = 'borderImage';
    } else if (options.lowerThan == 'Edge' || options.lowerThan == 'js:Promise') {
        options.lowerThan = 'js:Promise';
    }

    //all properties
    defaultOpts.bgColor = options.bgColor;
    defaultOpts.color = options.color;
    defaultOpts.lowerThan = options.lowerThan;
    defaultOpts.languagePath = options.languagePath;

    var bkgColor = defaultOpts.bgColor,
        txtColor = defaultOpts.color,
        cssProp = defaultOpts.lowerThan,
        languagePath = defaultOpts.languagePath;
} else {
    var bkgColor = defaultOpts.bgColor,
        txtColor = defaultOpts.color,
        cssProp = defaultOpts.lowerThan,
        languagePath = defaultOpts.languagePath;
} //end if options

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants