asDivElement method

DivElement asDivElement(
  1. Element element
)

Ensures that DOM element to render is a div. If not will insert a div inside the element and use it.

Implementation

DivElement asDivElement(Element element) {
  if (element is DivElement) return element;

  var div = DivElement();
  element.children.add(div);

  return div;
}