insertAfter method

DOMNode insertAfter(
  1. Object? indexSelector,
  2. Object? entry
)

Inserts entry after index of child node that matches indexSelector.

Implementation

DOMNode insertAfter(Object? indexSelector, Object? entry) {
  var idx = indexOf(indexSelector);

  if (idx >= 0) {
    idx++;

    var node = _parseNode(entry);
    _insertToContent(idx, node);
  } else if (indexSelector is num && isEmptyContent) {
    var node = _parseNode(entry);
    _addImpl(node);
  }

  normalizeContent();

  return this;
}