MCPcopy Create free account
hub / github.com/reactjs/react-rails / setValueForStyles

Function setValueForStyles

lib/assets/react-source/development/react.js:8283–8311  ·  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

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

Callers 2

setInitialDOMPropertiesFunction · 0.85
updateDOMPropertiesFunction · 0.85

Calls 1

dangerousStyleValueFunction · 0.70

Tested by

no test coverage detected