From 7131c7f607af564a4bbb8d264749dc65df815e52 Mon Sep 17 00:00:00 2001 From: Colin Marshall Date: Mon, 25 Jan 2016 21:01:39 -0700 Subject: [PATCH] Converted F6 Core JS string concatenations to template literals --- js/foundation.core.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/js/foundation.core.js b/js/foundation.core.js index 8154355ec..9dc041b8c 100644 --- a/js/foundation.core.js +++ b/js/foundation.core.js @@ -52,13 +52,13 @@ var Foundation = { var pluginName = name ? hyphenate(name) : functionName(plugin.constructor).toLowerCase(); plugin.uuid = this.GetYoDigits(6, pluginName); - if(!plugin.$element.attr('data-' + pluginName)){ plugin.$element.attr('data-' + pluginName, plugin.uuid); } + if(!plugin.$element.attr(`data-${pluginName}`)){ plugin.$element.attr(`data-${pluginName}`, plugin.uuid); } if(!plugin.$element.data('zfPlugin')){ plugin.$element.data('zfPlugin', plugin); } /** * Fires when the plugin has initialized. * @event Plugin#init */ - plugin.$element.trigger('init.zf.' + pluginName); + plugin.$element.trigger(`init.zf.${pluginName}`); this._uuids.push(plugin.uuid); @@ -76,12 +76,12 @@ var Foundation = { var pluginName = hyphenate(functionName(plugin.$element.data('zfPlugin').constructor)); this._uuids.splice(this._uuids.indexOf(plugin.uuid), 1); - plugin.$element.removeAttr('data-' + pluginName).removeData('zfPlugin') + plugin.$element.removeAttr(`data-${pluginName}`).removeData('zfPlugin') /** * Fires when the plugin has been destroyed. * @event Plugin#destroyed */ - .trigger('destroyed.zf.' + pluginName); + .trigger(`destroyed.zf.${pluginName}`); for(var prop in plugin){ plugin[prop] = null;//clean up script to prep for garbage collection. } @@ -136,7 +136,7 @@ var Foundation = { */ GetYoDigits: function(length, namespace){ length = length || 6; - return Math.round((Math.pow(36, length + 1) - Math.random() * Math.pow(36, length))).toString(36).slice(1) + (namespace ? '-' + namespace : ''); + return Math.round((Math.pow(36, length + 1) - Math.random() * Math.pow(36, length))).toString(36).slice(1) + (namespace ? `-${namespace}` : ''); }, /** * Initialize plugins on any elements within `elem` (and `elem` itself) that aren't already initialized. @@ -279,7 +279,7 @@ var foundation = function(method) { throw new ReferenceError("We're sorry, '" + method + "' is not an available method for " + (plugClass ? functionName(plugClass) : 'this element') + '.'); } }else{//error for invalid argument type - throw new TypeError("We're sorry, '" + type + "' is not a valid parameter. You must use a string representing the method you wish to invoke."); + throw new TypeError(`We're sorry, ${type} is not a valid parameter. You must use a string representing the method you wish to invoke.`); } return this; }; -- 2.47.2