Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / ckeditor / js / plugins / drupallink / plugin.js
index 1f7f8c46681d55c36fa06918c9d17da29775da97..d53f49a345ec2a1670fe8c675b0552863a954947 100644 (file)
 
   function getAttributes(editor, data) {
     var set = {};
-    for (var attributeName in data) {
-      if (data.hasOwnProperty(attributeName)) {
-        set[attributeName] = data[attributeName];
-      }
-    }
+    Object.keys(data || {}).forEach(function (attributeName) {
+      set[attributeName] = data[attributeName];
+    });
 
     set['data-cke-saved-href'] = set.href;
 
     var removed = {};
-    for (var s in set) {
-      if (set.hasOwnProperty(s)) {
-        delete removed[s];
-      }
-    }
+    Object.keys(set).forEach(function (s) {
+      delete removed[s];
+    });
 
     return {
       set: set,
 
               linkElement = getSelectedLink(editor);
             } else if (linkElement) {
-                for (var attrName in returnValues.attributes) {
-                  if (returnValues.attributes.hasOwnProperty(attrName)) {
-                    if (returnValues.attributes[attrName].length > 0) {
-                      var value = returnValues.attributes[attrName];
-                      linkElement.data('cke-saved-' + attrName, value);
-                      linkElement.setAttribute(attrName, value);
-                    } else {
-                        linkElement.removeAttribute(attrName);
-                      }
-                  }
-                }
+                Object.keys(returnValues.attributes || {}).forEach(function (attrName) {
+                  if (returnValues.attributes[attrName].length > 0) {
+                    var value = returnValues.attributes[attrName];
+                    linkElement.data('cke-saved-' + attrName, value);
+                    linkElement.setAttribute(attrName, value);
+                  } else {
+                      linkElement.removeAttribute(attrName);
+                    }
+                });
               }
 
             editor.fire('saveSnapshot');