stylesheet : $('<style></style>').appendTo('head')[0].sheet,
global: {
- namespace: ''
+ namespace: undefined
},
init : function (scope, libraries, method, options, response) {
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 : {},