merge method

  1. @override
bool merge(
  1. CSSStyleDeclaration other
)
override

Implementation

@override
bool merge(CSSStyleDeclaration other) {
  final bool updateStatus = super.merge(other);

  if (other is! ElementCSSStyleDeclaration) return updateStatus;

  bool pseudoUpdated = false;
  // Merge pseudo-element styles. Ensure target side is initialized so rules from
  // 'other' are not dropped when this side is null.
  if (other.pseudoBeforeStyle != null) {
    pseudoBeforeStyle ??= CSSStyleDeclaration.sheet();
    pseudoBeforeStyle!.merge(other.pseudoBeforeStyle!);
    pseudoUpdated = true;
  }
  if (other.pseudoAfterStyle != null) {
    pseudoAfterStyle ??= CSSStyleDeclaration.sheet();
    pseudoAfterStyle!.merge(other.pseudoAfterStyle!);
    pseudoUpdated = true;
  }
  if (other.pseudoFirstLetterStyle != null) {
    pseudoFirstLetterStyle ??= CSSStyleDeclaration.sheet();
    pseudoFirstLetterStyle!.merge(other.pseudoFirstLetterStyle!);
    pseudoUpdated = true;
  }
  if (other.pseudoFirstLineStyle != null) {
    pseudoFirstLineStyle ??= CSSStyleDeclaration.sheet();
    pseudoFirstLineStyle!.merge(other.pseudoFirstLineStyle!);
    pseudoUpdated = true;
  }

  return updateStatus || pseudoUpdated;
}