diff options
Diffstat (limited to 'WebCore/html/HTMLFormControlElement.cpp')
-rw-r--r-- | WebCore/html/HTMLFormControlElement.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/WebCore/html/HTMLFormControlElement.cpp b/WebCore/html/HTMLFormControlElement.cpp index daf4b93..88b47ac 100644 --- a/WebCore/html/HTMLFormControlElement.cpp +++ b/WebCore/html/HTMLFormControlElement.cpp @@ -162,7 +162,6 @@ void HTMLFormControlElement::willMoveToNewOwnerDocument() void HTMLFormControlElement::insertedIntoTree(bool deep) { if (fastHasAttribute(formAttr)) { - document()->registerFormElementWithFormAttribute(this); Element* element = document()->getElementById(fastGetAttribute(formAttr)); if (element && element->hasTagName(formTag)) { if (m_form) @@ -196,9 +195,6 @@ static inline Node* findRoot(Node* n) void HTMLFormControlElement::removedFromTree(bool deep) { - if (fastHasAttribute(formAttr)) - document()->unregisterFormElementWithFormAttribute(this); - // If the form and element are both in the same tree, preserve the connection to the form. // Otherwise, null out our form and remove ourselves from the form's list of elements. if (m_form && findRoot(this) != findRoot(m_form)) { @@ -209,6 +205,20 @@ void HTMLFormControlElement::removedFromTree(bool deep) HTMLElement::removedFromTree(deep); } +void HTMLFormControlElement::insertedIntoDocument() +{ + if (fastHasAttribute(formAttr)) + document()->registerFormElementWithFormAttribute(this); + HTMLElement::insertedIntoDocument(); +} + +void HTMLFormControlElement::removedFromDocument() +{ + if (fastHasAttribute(formAttr)) + document()->unregisterFormElementWithFormAttribute(this); + HTMLElement::removedFromDocument(); +} + const AtomicString& HTMLFormControlElement::formControlName() const { const AtomicString& name = fastGetAttribute(nameAttr); |