isPredefinedName static method

bool isPredefinedName(
  1. String name
)

Check if a name is a pre-defined CSS name.

This is used by the error handler to report if a name is unknown or used improperly.

Implementation

static bool isPredefinedName(String name) {
  final len = name.length;

  // TODO(terry): Add more pre-defined names (hidden, bolder, inherit, etc.).
  if (matchColorName(name) != null) return true;
  if (matchDirectives(name, 0, len) != -1) return true;
  if (matchMarginDirectives(name, 0, len) != -1) return true;
  if (matchUnits(name, 0, len) != -1) return true;

  return false;
}