From: alettieri Date: Sat, 1 Mar 2014 19:40:42 +0000 (-0800) Subject: Add ability to set namespace globally via js. Use global namespace if it has been... X-Git-Tag: v5.2.0~7^2~6^2 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=refs%2Fpull%2F4572%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Add ability to set namespace globally via js. Use global namespace if it has been set otherwise default to meta.foundation-data-attribute-namespace --- diff --git a/js/foundation/foundation.js b/js/foundation/foundation.js index 666e18bf8..d5be807cd 100644 --- a/js/foundation/foundation.js +++ b/js/foundation/foundation.js @@ -359,10 +359,19 @@ }, set_namespace: function () { - var namespace = $('.foundation-data-attribute-namespace').css('font-family'); - if (/false/i.test(namespace)) return; + // 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'; + // + // 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; + this.global.namespace = namespace; },