I got this code:
var config = {};
config.knock = {
self:null,
init : function(){
self = this;
console.log(self)
}
};
$(document).ready( function(){
config.knock.init();
});
Firefox (8) tells me self is the config.knock object, but Opera (11.00) tells its Window object. Who’s correct?
self[MDN] is a property of thewindowobject. It seems that Opera does not allow to override it.As you are not declaring your variable with
var, thisis the same as
in your case.
You either want
var self, or, if you want to refer toconfig.knock.self, eitherconfig.knock.selforthis.self.In Firefox as well as in Opera,
thiswill refer toconfig.knock.