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

Function setValueForStyles

code/composition/public/app.js:15224–15246  ·  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

15222 * @param {object} styles
15223 */
15224function setValueForStyles(node, styles, getStack) {
15225 var style = node.style;
15226 for (var styleName in styles) {
15227 if (!styles.hasOwnProperty(styleName)) {
15228 continue;
15229 }
15230 var isCustomProperty = styleName.indexOf('--') === 0;
15231 {
15232 if (!isCustomProperty) {
15233 warnValidStyle$1(styleName, styles[styleName], getStack);
15234 }
15235 }
15236 var styleValue = dangerousStyleValue(styleName, styles[styleName], isCustomProperty);
15237 if (styleName === 'float') {
15238 styleName = 'cssFloat';
15239 }
15240 if (isCustomProperty) {
15241 style.setProperty(styleName, styleValue);
15242 } else {
15243 style[styleName] = styleValue;
15244 }
15245 }
15246}
15247
15248// For HTML, certain tags should omit their close tag. We keep a whitelist for
15249// those special-case tags.

Callers 2

setInitialDOMPropertiesFunction · 0.70
updateDOMPropertiesFunction · 0.70

Calls 1

dangerousStyleValueFunction · 0.70

Tested by

no test coverage detected