getAllChildNodesWithID method

List<Element> getAllChildNodesWithID(
  1. Element element
)

Implementation

List<Element> getAllChildNodesWithID(Element element) {
  var allChildNodesWithID = <Element>[];

  if (element.attributes.containsKey('id')) {
    return [element];
  }

  for (var e in element.children) {
    allChildNodesWithID.addAll(getAllChildNodesWithID(e));
  }

  return allChildNodesWithID;
}