moveUpNode method

bool moveUpNode(
  1. DOMNode node
)

Moves node up in the children list.

Implementation

bool moveUpNode(DOMNode node) {
  if (isEmptyContent) return false;

  var idx = indexOfNodeIdenticalFirst(node);
  if (idx < 0) return false;
  if (idx == 0) return true;

  _content!.removeAt(idx);

  var idxUp = _contentFromIndexBackwardWhere(
      idx - 1, 0, (node) => node is DOMElement);
  if (idxUp < 0) {
    idxUp = 0;
  }

  _content!.insert(idxUp, node);
  node.parent = this;
  return true;
}