From ed4b8fbd9c61f56e06429ee44f9ac433db8c5c96 Mon Sep 17 00:00:00 2001 From: alettieri Date: Sat, 1 Mar 2014 11:40:42 -0800 Subject: [PATCH] Add ability to set namespace globally via js. Use global namespace if it has been set otherwise default to meta.foundation-data-attribute-namespace --- js/foundation/foundation.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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; }, -- 2.47.2