defineCSS function

CSSStyleDeclaration defineCSS(
  1. CSSStyleDeclaration? currentCSS,
  2. CSSStyleDeclaration? appendCSS, [
  3. dynamic defaultCSS
])

Defines a new CSSStyleDeclaration merging currentCSS and appendCSS.

defaultCSS if currentCSS and appendCSS are null.

Implementation

CSSStyleDeclaration defineCSS(
    CSSStyleDeclaration? currentCSS, CSSStyleDeclaration? appendCSS,
    [dynamic defaultCSS]) {
  if (currentCSS == null) {
    return appendCSS ?? asCssStyleDeclaration(defaultCSS);
  } else if (appendCSS == null) {
    return currentCSS;
  } else {
    var css = HTMLTemplateElement().style;
    css.cssText = '${currentCSS.cssText} ; ${appendCSS.cssText}';
    return css;
  }
}