function setData(element, name, data) {
  if (isObject(data)) {
    element[name] = data;
  } else if (element.dataset) {
    element.dataset[name] = data;
  } else {
    element.setAttribute("data-".concat(toParamCase(name)), data);
  }
}
Set data to the given element.
@param {Element} element - The target element.
@param {string} name - The data key to set.
@param {string} data - The data value.