* 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)
| 4709 | */ |
| 4710 | |
| 4711 | function setValueForStyles(node, styles) { |
| 4712 | var style = node.style; |
| 4713 | |
| 4714 | for (var styleName in styles) { |
| 4715 | if (!styles.hasOwnProperty(styleName)) { |
| 4716 | continue; |
| 4717 | } |
| 4718 | |
| 4719 | var isCustomProperty = styleName.indexOf('--') === 0; |
| 4720 | |
| 4721 | { |
| 4722 | if (!isCustomProperty) { |
| 4723 | warnValidStyle$1(styleName, styles[styleName]); |
| 4724 | } |
| 4725 | } |
| 4726 | |
| 4727 | var styleValue = dangerousStyleValue(styleName, styles[styleName], isCustomProperty); |
| 4728 | |
| 4729 | if (styleName === 'float') { |
| 4730 | styleName = 'cssFloat'; |
| 4731 | } |
| 4732 | |
| 4733 | if (isCustomProperty) { |
| 4734 | style.setProperty(styleName, styleValue); |
| 4735 | } else { |
| 4736 | style[styleName] = styleValue; |
| 4737 | } |
| 4738 | } |
| 4739 | } |
| 4740 | |
| 4741 | function isValueEmpty(value) { |
| 4742 | return value == null || typeof value === 'boolean' || value === ''; |
no test coverage detected