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

Function createDangerousStringForStyles

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

15194 * comparison. It is only used in DEV for SSR validation.
15195 */
15196function createDangerousStringForStyles(styles) {
15197 {
15198 var serialized = '';
15199 var delimiter = '';
15200 for (var styleName in styles) {
15201 if (!styles.hasOwnProperty(styleName)) {
15202 continue;
15203 }
15204 var styleValue = styles[styleName];
15205 if (styleValue != null) {
15206 var isCustomProperty = styleName.indexOf('--') === 0;
15207 serialized += delimiter + hyphenateStyleName(styleName) + ':';
15208 serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty);
15209
15210 delimiter = ';';
15211 }
15212 }
15213 return serialized || null;
15214 }
15215}
15216
15217/**
15218 * 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