(self, tag)
| 124 | self.tags.appendleft(tag) |
| 125 | |
| 126 | def handle_endtag(self, tag): |
| 127 | if tag not in self.void_elements: |
| 128 | self.output.append(f"</{tag}>") |
| 129 | # Remove from the stack only if the tag matches the most recently |
| 130 | # opened tag (LIFO). This avoids O(n) linear scans for unmatched |
| 131 | # end tags if `deque.remove()` would be called. |
| 132 | if self.tags and self.tags[0] == tag: |
| 133 | self.tags.popleft() |
| 134 | |
| 135 | def handle_data(self, data): |
| 136 | data, output = self.process(data) |
no test coverage detected