| 1 |
/** |
| 2 |
* Set the attributes to the given popper |
| 3 |
* @method |
| 4 |
* @memberof Popper.Utils |
| 5 |
* @argument {Element} element - Element to apply the attributes to |
| 6 |
* @argument {Object} styles |
| 7 |
* Object with a list of properties and values which will be applied to the element |
| 8 |
*/ |
| 9 |
export default function setAttributes(element, attributes) { |
| 10 |
Object.keys(attributes).forEach(function(prop) { |
| 11 |
const value = attributes[prop]; |
| 12 |
if (value !== false) { |
| 13 |
element.setAttribute(prop, attributes[prop]); |
| 14 |
} else { |
| 15 |
element.removeAttribute(prop); |
| 16 |
} |
| 17 |
}); |
| 18 |
} |