]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Add ability to set namespace globally via js. Use global namespace if it has been... 4572/head
authoralettieri <alettieri@gmail.com>
Sat, 1 Mar 2014 19:40:42 +0000 (11:40 -0800)
committeralettieri <alettieri@gmail.com>
Sat, 1 Mar 2014 19:40:42 +0000 (11:40 -0800)
js/foundation/foundation.js

index 666e18bf82e553b24946550d741d13d4b5a5cbd7..d5be807cda192a60b6b391dbda0cde0e247ea329 100644 (file)
     },
 
     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;
     },