Index: Source/core/dom/Attr.cpp |
diff --git a/Source/core/dom/Attr.cpp b/Source/core/dom/Attr.cpp |
index 496203f6950b630ad01404583f55caa90b3688ee..b4d7c830076eca565f626b2c00ccdea3a86eba82 100644 |
--- a/Source/core/dom/Attr.cpp |
+++ b/Source/core/dom/Attr.cpp |
@@ -219,9 +219,15 @@ void Attr::attachToElement(Element* element, const AtomicString& attachedLocalNa |
m_standaloneValueOrAttachedLocalName = attachedLocalName; |
} |
+void Attr::clearWeakMembers(Visitor* visitor) |
+{ |
+ if (m_element && !visitor->isAlive(m_element)) |
+ detachFromElementWithValue(value()); |
+} |
+ |
void Attr::trace(Visitor* visitor) |
{ |
- visitor->trace(m_element); |
+ visitor->registerWeakMembers<Attr, &Attr::clearWeakMembers>(this); |
ContainerNode::trace(visitor); |
} |