- 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);
+ }
+ });