$table function

TABLEElement $table({
  1. Object? id,
  2. Object? classes,
  3. Object? style,
  4. Object? thsStyle,
  5. Object? tdsStyle,
  6. Object? trsStyle,
  7. Map<String, String>? attributes,
  8. Object? caption,
  9. Object? head,
  10. Object? body,
  11. Object? foot,
  12. bool? hidden,
  13. bool commented = false,
})

Creates a table node.

Implementation

TABLEElement $table({
  Object? id,
  Object? classes,
  Object? style,
  Object? thsStyle,
  Object? tdsStyle,
  Object? trsStyle,
  Map<String, String>? attributes,
  Object? caption,
  Object? head,
  Object? body,
  Object? foot,
  bool? hidden,
  bool commented = false,
}) {
  var tableElement = TABLEElement(
    id: id,
    classes: classes,
    style: style,
    attributes: attributes,
    caption: caption,
    head: head,
    body: body,
    foot: foot,
    hidden: hidden,
    commented: commented,
  );

  if (thsStyle != null) {
    var css = CSS(thsStyle);
    tableElement.selectAllByType<THElement>().forEach(
      (e) => e.style.putAllIfAbsent(css.entries),
    );
  }

  if (tdsStyle != null) {
    var css = CSS(tdsStyle);
    tableElement.selectAllByType<TDElement>().forEach(
      (e) => e.style.putAllIfAbsent(css.entries),
    );
  }

  if (trsStyle != null) {
    var css = CSS(trsStyle);
    tableElement.selectAllByType<TRowElement>().forEach(
      (e) => e.style.putAllIfAbsent(css.entries),
    );
  }

  return tableElement;
}