Why addNamespace(...) is removed?

Michael Schwarz on Tuesday, July 18, 2006

I removed addNamespace because of the missing support on older web browsers or mobile devices. The problem is that addNamespace will add a new property to the window object. This is working great on all common web browsers. See the next lines to see how you can change addNamespace usage to get your JavaScript working on all web browsers.

Old way:

addNamespace("Company.Utils.Web");

New way:

if(typeof(Company) "undefined") Company = {};if(typeof(Company.Utils) "undefined") Company.Utils = {};
if(typeof(Company.Utils.Web) == "undefined") Company.Utils.Web = {}