Index: Source/WebCore/svg/SVGTRefElement.cpp |
=================================================================== |
--- Source/WebCore/svg/SVGTRefElement.cpp (revision 112607) |
+++ Source/WebCore/svg/SVGTRefElement.cpp (working copy) |
@@ -227,6 +227,10 @@ |
// Remove any existing event listener. |
clearEventListener(); |
+ // If we're not yet in a document, this function will be called again from insertedIntoDocument(). |
+ if (!inDocument()) |
+ return; |
+ |
String id; |
Element* target = SVGURIReference::targetElementFromIRIString(href(), document(), &id); |
if (!target) { |
@@ -241,10 +245,6 @@ |
updateReferencedText(); |
- // We should not add the event listener if we are not in document yet. |
- if (!inDocument()) |
- return; |
- |
m_eventListener = SubtreeModificationEventListener::create(this, id); |
ASSERT(target->parentNode()); |
target->parentNode()->addEventListener(eventNames().DOMSubtreeModifiedEvent, m_eventListener.get(), false); |