From 121ac2383c4628bc7884991675409929b0249ea7 Mon Sep 17 00:00:00 2001 From: alettieri Date: Sat, 29 Mar 2014 13:51:46 -0700 Subject: [PATCH] Adjust set_namespace to default to using meta if undefined. Otherwise, can be set to namespace string, empty string or false --- js/foundation/foundation.js | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) 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 : {}, -- 2.47.2