* Sets the value for multiple styles on a node. If a value is specified as * '' (empty string), the corresponding style property will be unset. * * @param {DOMElement} node * @param {object} styles
(node, styles)
| 8281 | */ |
| 8282 | |
| 8283 | function setValueForStyles(node, styles) { |
| 8284 | var style = node.style; |
| 8285 | |
| 8286 | for (var styleName in styles) { |
| 8287 | if (!styles.hasOwnProperty(styleName)) { |
| 8288 | continue; |
| 8289 | } |
| 8290 | |
| 8291 | var isCustomProperty = styleName.indexOf('--') === 0; |
| 8292 | |
| 8293 | { |
| 8294 | if (!isCustomProperty) { |
| 8295 | warnValidStyle$1(styleName, styles[styleName]); |
| 8296 | } |
| 8297 | } |
| 8298 | |
| 8299 | var styleValue = dangerousStyleValue(styleName, styles[styleName], isCustomProperty); |
| 8300 | |
| 8301 | if (styleName === 'float') { |
| 8302 | styleName = 'cssFloat'; |
| 8303 | } |
| 8304 | |
| 8305 | if (isCustomProperty) { |
| 8306 | style.setProperty(styleName, styleValue); |
| 8307 | } else { |
| 8308 | style[styleName] = styleValue; |
| 8309 | } |
| 8310 | } |
| 8311 | } |
| 8312 | |
| 8313 | function isValueEmpty(value) { |
| 8314 | return value == null || typeof value === 'boolean' || value === ''; |
no test coverage detected