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

Function createDangerousStringForStyles

code/styling/public/app.js:15058–15077  ·  view source on GitHub ↗

* This creates a string that is expected to be equivalent to the style * attribute generated by server-side rendering. It by-passes warnings and * security checks so it's not safe to use this value for anything other than * comparison. It is only used in DEV for SSR validation.

(styles)

Source from the content-addressed store, hash-verified

15056 * comparison. It is only used in DEV for SSR validation.
15057 */
15058function createDangerousStringForStyles(styles) {
15059 {
15060 var serialized = '';
15061 var delimiter = '';
15062 for (var styleName in styles) {
15063 if (!styles.hasOwnProperty(styleName)) {
15064 continue;
15065 }
15066 var styleValue = styles[styleName];
15067 if (styleValue != null) {
15068 var isCustomProperty = styleName.indexOf('--') === 0;
15069 serialized += delimiter + hyphenateStyleName(styleName) + ':';
15070 serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty);
15071
15072 delimiter = ';';
15073 }
15074 }
15075 return serialized || null;
15076 }
15077}
15078
15079/**
15080 * Sets the value for multiple styles on a node. If a value is specified as

Callers 1

diffHydratedProperties$1Function · 0.70

Calls 2

hyphenateStyleNameFunction · 0.70
dangerousStyleValueFunction · 0.70

Tested by

no test coverage detected