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

Function setValueForStyles

code/dependency-injection/public/app.js:15179–15201  ·  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

15177 * @param {object} styles
15178 */
15179function setValueForStyles(node, styles, getStack) {
15180 var style = node.style;
15181 for (var styleName in styles) {
15182 if (!styles.hasOwnProperty(styleName)) {
15183 continue;
15184 }
15185 var isCustomProperty = styleName.indexOf('--') === 0;
15186 {
15187 if (!isCustomProperty) {
15188 warnValidStyle$1(styleName, styles[styleName], getStack);
15189 }
15190 }
15191 var styleValue = dangerousStyleValue(styleName, styles[styleName], isCustomProperty);
15192 if (styleName === 'float') {
15193 styleName = 'cssFloat';
15194 }
15195 if (isCustomProperty) {
15196 style.setProperty(styleName, styleValue);
15197 } else {
15198 style[styleName] = styleValue;
15199 }
15200 }
15201}
15202
15203// For HTML, certain tags should omit their close tag. We keep a whitelist for
15204// those special-case tags.

Callers 2

setInitialDOMPropertiesFunction · 0.70
updateDOMPropertiesFunction · 0.70

Calls 1

dangerousStyleValueFunction · 0.70

Tested by

no test coverage detected