addFormattingElement method
void
addFormattingElement(
- StartTagToken token
Implementation
void addFormattingElement(StartTagToken token) {
tree.insertElement(token);
final element = tree.openElements.last;
final matchingElements = <Node?>[];
for (Node? node in tree.activeFormattingElements.reversed) {
if (node == null) {
break;
} else if (isMatchingFormattingElement(node as Element, element)) {
matchingElements.add(node);
}
}
assert(matchingElements.length <= 3);
if (matchingElements.length == 3) {
tree.activeFormattingElements.remove(matchingElements.last);
}
tree.activeFormattingElements.add(element);
}