MCPcopy Create free account
hub / github.com/microsoft/SandDance / setValueForStyles

Function setValueForStyles

docs/external/js/react-dom.development.js:4711–4739  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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 === '';

Callers 2

setInitialDOMPropertiesFunction · 0.85
updateDOMPropertiesFunction · 0.85

Calls 1

dangerousStyleValueFunction · 0.85

Tested by

no test coverage detected