current_classes = set()
result = []
for group in group_tags_at_same_position(tags):
opening, closing = [], []
for tag in group:
if tag.is_opening_tag:
opening.append(tag)
After Change
// handle closing tags at current position
closing_added = False
if len(closing) > 0:
closing_tag = Tag(pos, False, "")
for tag in closing:
current_classes.remove(tag.css_class)
result.append(closing_tag)
closing_added = True