previousElement property

  1. @override
Bs4Element? previousElement

The previousElement is an element that was parsed immediately before the current element (firstly searches previousSiblings, if empty then parent).

Use previousParsed if you want to get any type (doc comment, part of string, ...).

Implementation

@override
Bs4Element? get previousElement {
  // find within prev sibling
  final prevSibling = previousSibling;
  if (prevSibling != null) {
    return prevSibling;
  }

  // find within parent, or null
  return parent;
}