removeShorthandBorder static method

void removeShorthandBorder(
  1. CSSStyleDeclaration style,
  2. String property, [
  3. bool? isImportant
])

Implementation

static void removeShorthandBorder(CSSStyleDeclaration style, String property, [bool? isImportant]) {
  if (property == BORDER ||
      property == BORDER_TOP ||
      property == BORDER_RIGHT ||
      property == BORDER_BOTTOM ||
      property == BORDER_LEFT ||
      property == BORDER_INLINE_START ||
      property == BORDER_INLINE_END ||
      property == BORDER_BLOCK_START ||
      property == BORDER_BLOCK_END) {
    if (property == BORDER || property == BORDER_TOP) {
      if (style.contains(BORDER_TOP_COLOR)) style.removeProperty(BORDER_TOP_COLOR, isImportant);
      if (style.contains(BORDER_TOP_STYLE)) style.removeProperty(BORDER_TOP_STYLE, isImportant);
      if (style.contains(BORDER_TOP_WIDTH)) style.removeProperty(BORDER_TOP_WIDTH, isImportant);
    }
    if (property == BORDER || property == BORDER_RIGHT) {
      if (style.contains(BORDER_RIGHT_COLOR)) style.removeProperty(BORDER_RIGHT_COLOR, isImportant);
      if (style.contains(BORDER_RIGHT_STYLE)) style.removeProperty(BORDER_RIGHT_STYLE, isImportant);
      if (style.contains(BORDER_RIGHT_WIDTH)) style.removeProperty(BORDER_RIGHT_WIDTH, isImportant);
    }
    if (property == BORDER || property == BORDER_BOTTOM) {
      if (style.contains(BORDER_BOTTOM_COLOR)) style.removeProperty(BORDER_BOTTOM_COLOR, isImportant);
      if (style.contains(BORDER_BOTTOM_STYLE)) style.removeProperty(BORDER_BOTTOM_STYLE, isImportant);
      if (style.contains(BORDER_BOTTOM_WIDTH)) style.removeProperty(BORDER_BOTTOM_WIDTH, isImportant);
    }
    if (property == BORDER || property == BORDER_LEFT) {
      if (style.contains(BORDER_LEFT_COLOR)) style.removeProperty(BORDER_LEFT_COLOR, isImportant);
      if (style.contains(BORDER_LEFT_STYLE)) style.removeProperty(BORDER_LEFT_STYLE, isImportant);
      if (style.contains(BORDER_LEFT_WIDTH)) style.removeProperty(BORDER_LEFT_WIDTH, isImportant);
    }
    if (property == BORDER_INLINE_START) {
      if (style.contains(BORDER_INLINE_START_COLOR)) style.removeProperty(BORDER_INLINE_START_COLOR, isImportant);
      if (style.contains(BORDER_INLINE_START_STYLE)) style.removeProperty(BORDER_INLINE_START_STYLE, isImportant);
      if (style.contains(BORDER_INLINE_START_WIDTH)) style.removeProperty(BORDER_INLINE_START_WIDTH, isImportant);
    }
    if (property == BORDER_INLINE_END) {
      if (style.contains(BORDER_INLINE_END_COLOR)) style.removeProperty(BORDER_INLINE_END_COLOR, isImportant);
      if (style.contains(BORDER_INLINE_END_STYLE)) style.removeProperty(BORDER_INLINE_END_STYLE, isImportant);
      if (style.contains(BORDER_INLINE_END_WIDTH)) style.removeProperty(BORDER_INLINE_END_WIDTH, isImportant);
    }
    if (property == BORDER_BLOCK_START) {
      if (style.contains(BORDER_BLOCK_START_COLOR)) style.removeProperty(BORDER_BLOCK_START_COLOR, isImportant);
      if (style.contains(BORDER_BLOCK_START_STYLE)) style.removeProperty(BORDER_BLOCK_START_STYLE, isImportant);
      if (style.contains(BORDER_BLOCK_START_WIDTH)) style.removeProperty(BORDER_BLOCK_START_WIDTH, isImportant);
    }
    if (property == BORDER_BLOCK_END) {
      if (style.contains(BORDER_BLOCK_END_COLOR)) style.removeProperty(BORDER_BLOCK_END_COLOR, isImportant);
      if (style.contains(BORDER_BLOCK_END_STYLE)) style.removeProperty(BORDER_BLOCK_END_STYLE, isImportant);
      if (style.contains(BORDER_BLOCK_END_WIDTH)) style.removeProperty(BORDER_BLOCK_END_WIDTH, isImportant);
    }
  } else {
    if (property == BORDER_WIDTH) {
      if (style.contains(BORDER_TOP_WIDTH)) style.removeProperty(BORDER_TOP_WIDTH, isImportant);
      if (style.contains(BORDER_RIGHT_WIDTH)) style.removeProperty(BORDER_RIGHT_WIDTH, isImportant);
      if (style.contains(BORDER_BOTTOM_WIDTH)) style.removeProperty(BORDER_BOTTOM_WIDTH, isImportant);
      if (style.contains(BORDER_LEFT_WIDTH)) style.removeProperty(BORDER_LEFT_WIDTH, isImportant);
    } else if (property == BORDER_STYLE) {
      if (style.contains(BORDER_TOP_STYLE)) style.removeProperty(BORDER_TOP_STYLE, isImportant);
      if (style.contains(BORDER_RIGHT_STYLE)) style.removeProperty(BORDER_RIGHT_STYLE, isImportant);
      if (style.contains(BORDER_BOTTOM_STYLE)) style.removeProperty(BORDER_BOTTOM_STYLE, isImportant);
      if (style.contains(BORDER_LEFT_STYLE)) style.removeProperty(BORDER_LEFT_STYLE, isImportant);
    } else if (property == BORDER_COLOR) {
      if (style.contains(BORDER_TOP_COLOR)) style.removeProperty(BORDER_TOP_COLOR, isImportant);
      if (style.contains(BORDER_RIGHT_COLOR)) style.removeProperty(BORDER_RIGHT_COLOR, isImportant);
      if (style.contains(BORDER_BOTTOM_COLOR)) style.removeProperty(BORDER_BOTTOM_COLOR, isImportant);
      if (style.contains(BORDER_LEFT_COLOR)) style.removeProperty(BORDER_LEFT_COLOR, isImportant);
    }
  }
}