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

Function setValueForStyles

code/third-party/public/app.js:14319–14341  ·  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

14317 * @param {object} styles
14318 */
14319function setValueForStyles(node, styles, getStack) {
14320 var style = node.style;
14321 for (var styleName in styles) {
14322 if (!styles.hasOwnProperty(styleName)) {
14323 continue;
14324 }
14325 var isCustomProperty = styleName.indexOf('--') === 0;
14326 {
14327 if (!isCustomProperty) {
14328 warnValidStyle$1(styleName, styles[styleName], getStack);
14329 }
14330 }
14331 var styleValue = dangerousStyleValue(styleName, styles[styleName], isCustomProperty);
14332 if (styleName === 'float') {
14333 styleName = 'cssFloat';
14334 }
14335 if (isCustomProperty) {
14336 style.setProperty(styleName, styleValue);
14337 } else {
14338 style[styleName] = styleValue;
14339 }
14340 }
14341}
14342
14343// For HTML, certain tags should omit their close tag. We keep a whitelist for
14344// those special-case tags.

Callers 2

setInitialDOMPropertiesFunction · 0.70
updateDOMPropertiesFunction · 0.70

Calls 1

dangerousStyleValueFunction · 0.70

Tested by

no test coverage detected