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

Function createDangerousStringForStyles

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

14289 * comparison. It is only used in DEV for SSR validation.
14290 */
14291function createDangerousStringForStyles(styles) {
14292 {
14293 var serialized = '';
14294 var delimiter = '';
14295 for (var styleName in styles) {
14296 if (!styles.hasOwnProperty(styleName)) {
14297 continue;
14298 }
14299 var styleValue = styles[styleName];
14300 if (styleValue != null) {
14301 var isCustomProperty = styleName.indexOf('--') === 0;
14302 serialized += delimiter + hyphenateStyleName(styleName) + ':';
14303 serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty);
14304
14305 delimiter = ';';
14306 }
14307 }
14308 return serialized || null;
14309 }
14310}
14311
14312/**
14313 * 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