Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / quickedit / js / theme.js
index f01e238514c5d15be016ae5881d847e0218aeff5..8b12cd7651d1ad8dda313a5116a16ad6c8eaa96e 100644 (file)
@@ -53,7 +53,8 @@
 
   Drupal.theme.quickeditButtons = function (settings) {
     var html = '';
-    for (var i = 0; i < settings.buttons.length; i++) {
+
+    var _loop = function _loop(i) {
       var button = settings.buttons[i];
       if (!button.hasOwnProperty('type')) {
         button.type = 'button';
 
       var attributes = [];
       var attrMap = settings.buttons[i].attributes || {};
-      for (var attr in attrMap) {
-        if (attrMap.hasOwnProperty(attr)) {
-          attributes.push(attr + (attrMap[attr] ? '="' + attrMap[attr] + '"' : ''));
-        }
-      }
-      html += '<button type="' + button.type + '" class="' + button.classes + '"' + (' ' + attributes.join(' ') + '>');
-      html += button.label;
-      html += '</button>';
+      Object.keys(attrMap).forEach(function (attr) {
+        attributes.push(attr + (attrMap[attr] ? '="' + attrMap[attr] + '"' : ''));
+      });
+      html += '<button type="' + button.type + '" class="' + button.classes + '" ' + attributes.join(' ') + '>' + button.label + '</button>';
+    };
+
+    for (var i = 0; i < settings.buttons.length; i++) {
+      _loop(i);
     }
     return html;
   };