From: alettieri Date: Sat, 29 Mar 2014 20:51:46 +0000 (-0700) Subject: Adjust set_namespace to default to using meta if undefined. Otherwise, can be set... X-Git-Tag: v5.2.2~46^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F4846%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Adjust set_namespace to default to using meta if undefined. Otherwise, can be set to namespace string, empty string or false --- diff --git a/js/foundation/foundation.js b/js/foundation/foundation.js index d674c54e8..238a1665e 100644 --- a/js/foundation/foundation.js +++ b/js/foundation/foundation.js @@ -289,7 +289,7 @@ stylesheet : $('').appendTo('head')[0].sheet, global: { - namespace: '' + namespace: undefined }, init : function (scope, libraries, method, options, response) { @@ -362,19 +362,24 @@ set_namespace: function () { - // Don't bother reading the namespace out of the meta tag - // if the namespace has been set globally in javascript + // Description: + // Don't bother reading the namespace out of the meta tag + // if the namespace has been set globally in javascript // - // Example: something like Foundation.global.namespace = 'my-namespace'; + // Example: + // Foundation.global.namespace = 'my-namespace'; + // or make it an empty string: + // Foundation.global.namespace = ''; // - // Otherwise, if the namespace hasn't been set globally, - // read it out of the meta tag // - var namespace = this.global.namespace || $('.foundation-data-attribute-namespace').css('font-family'); - if (/false/i.test(namespace)) return; + // If the namespace has not been set (is undefined), try to read it out of the meta element. + // Otherwise use the globally defined namespace, even if it's empty ('') + var namespace = ( this.global.namespace === undefined ) ? $('.foundation-data-attribute-namespace').css('font-family') : this.global.namespace; - this.global.namespace = namespace; + // Finally, if the namsepace is either undefined or false, set it to an empty string. + // Otherwise use the namespace value. + this.global.namespace = ( namespace === undefined || /false/i.test(namespace) ) ? '' : namespace; }, libs : {},