MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / setValueForStyles

Function setValueForStyles

code/styling/public/app.js:15086–15108  ·  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, getStack)

Source from the content-addressed store, hash-verified

15084 * @param {object} styles
15085 */
15086function setValueForStyles(node, styles, getStack) {
15087 var style = node.style;
15088 for (var styleName in styles) {
15089 if (!styles.hasOwnProperty(styleName)) {
15090 continue;
15091 }
15092 var isCustomProperty = styleName.indexOf('--') === 0;
15093 {
15094 if (!isCustomProperty) {
15095 warnValidStyle$1(styleName, styles[styleName], getStack);
15096 }
15097 }
15098 var styleValue = dangerousStyleValue(styleName, styles[styleName], isCustomProperty);
15099 if (styleName === 'float') {
15100 styleName = 'cssFloat';
15101 }
15102 if (isCustomProperty) {
15103 style.setProperty(styleName, styleValue);
15104 } else {
15105 style[styleName] = styleValue;
15106 }
15107 }
15108}
15109
15110// For HTML, certain tags should omit their close tag. We keep a whitelist for
15111// those special-case tags.

Callers 2

setInitialDOMPropertiesFunction · 0.70
updateDOMPropertiesFunction · 0.70

Calls 1

dangerousStyleValueFunction · 0.70

Tested by

no test coverage detected