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

Function setValueForStyles

code/communication/public/app.js:15121–15143  ·  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

15119 * @param {object} styles
15120 */
15121function setValueForStyles(node, styles, getStack) {
15122 var style = node.style;
15123 for (var styleName in styles) {
15124 if (!styles.hasOwnProperty(styleName)) {
15125 continue;
15126 }
15127 var isCustomProperty = styleName.indexOf('--') === 0;
15128 {
15129 if (!isCustomProperty) {
15130 warnValidStyle$1(styleName, styles[styleName], getStack);
15131 }
15132 }
15133 var styleValue = dangerousStyleValue(styleName, styles[styleName], isCustomProperty);
15134 if (styleName === 'float') {
15135 styleName = 'cssFloat';
15136 }
15137 if (isCustomProperty) {
15138 style.setProperty(styleName, styleValue);
15139 } else {
15140 style[styleName] = styleValue;
15141 }
15142 }
15143}
15144
15145// For HTML, certain tags should omit their close tag. We keep a whitelist for
15146// those special-case tags.

Callers 2

setInitialDOMPropertiesFunction · 0.70
updateDOMPropertiesFunction · 0.70

Calls 1

dangerousStyleValueFunction · 0.70

Tested by

no test coverage detected