* Set the style to the given popper * @method * @memberof Popper.Utils * @argument {Element} element - Element to apply the style to * @argument {Object} styles * Object with a list of properties and values which will be applied to the element
(element, styles)
| 4107 | |
| 4108 | |
| 4109 | function setStyles(element, styles) { |
| 4110 | Object.keys(styles).forEach(function (prop) { |
| 4111 | var unit = ''; // add unit if the value is numeric and is one of the following |
| 4112 | |
| 4113 | if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) { |
| 4114 | unit = 'px'; |
| 4115 | } |
| 4116 | |
| 4117 | element.style[prop] = styles[prop] + unit; |
| 4118 | }); |
| 4119 | } |
| 4120 | /** |
| 4121 | * Set the attributes to the given popper |
| 4122 | * @method |
no test coverage detected
searching dependent graphs…