Remove highlight boxes associated with an old DOM node

This commit is contained in:
Isaiah Odhner 2023-06-03 15:32:10 -04:00
parent 377a883d3b
commit 89ff582c3d

View File

@ -838,7 +838,9 @@ class Inspector(Container):
for index, region in enumerate(regions): for index, region in enumerate(regions):
show_box(f"clipped:{index}", region, "aquamarine") show_box(f"clipped:{index}", region, "aquamarine")
# remove unused boxes # remove unused boxes
for name, box in list(self._highlight_boxes[dom_node].items()): # including boxes associated with an old dom_node
if box not in used_boxes: for dom_node, boxes in list(self._highlight_boxes.items()):
box.remove() for name, box in list(boxes.items()):
del self._highlight_boxes[dom_node][name] if box not in used_boxes:
box.remove()
del self._highlight_boxes[dom_node][name]