Added check for document.namespaces for use in compiled versions of Dojo (without, it will break all browsers but IE8 and below)