normalizePropertyName static method

String normalizePropertyName(
  1. String propertyName
)

Normalize incoming property names into the internal camelCase form and fold supported vendor-prefixed aliases into their standard equivalents.

This is intentionally conservative: it preserves CSS custom properties (variables) verbatim and only folds a small set of WebKit-prefixed flexbox aliases that appear in legacy content/tests.

Implementation

static String normalizePropertyName(String propertyName) {
  String name = propertyName.trim();
  if (name.isEmpty) return name;

  // Preserve CSS custom properties (variables) verbatim.
  if (CSSVariable.isCSSSVariableProperty(name)) return name;

  // CSSOM `setProperty('border-width', ...)` style names are kebab-case.
  // Internally WebF uses camelCase keys.
  if (name.contains('-')) {
    name = camelize(name);
  }

  // Legacy WebKit-prefixed modern flexbox properties map to the standard ones.
  switch (name) {
    case 'WebkitAlignItems':
    case 'webkitAlignItems':
      return ALIGN_ITEMS;
    case 'WebkitAlignSelf':
    case 'webkitAlignSelf':
      return ALIGN_SELF;
    case 'WebkitAlignContent':
    case 'webkitAlignContent':
      return ALIGN_CONTENT;
    case 'WebkitJustifyContent':
    case 'webkitJustifyContent':
      return JUSTIFY_CONTENT;
    case 'WebkitFlex':
    case 'webkitFlex':
      return FLEX;
    case 'WebkitFlexDirection':
    case 'webkitFlexDirection':
      return FLEX_DIRECTION;
    case 'WebkitFlexWrap':
    case 'webkitFlexWrap':
      return FLEX_WRAP;
    case 'WebkitFlexFlow':
    case 'webkitFlexFlow':
      return FLEX_FLOW;
    case 'WebkitOrder':
    case 'webkitOrder':
      return ORDER;
  }

  return name;
}