CVS commit by ggarand: register form elements dynamically created from JS (webcore merge) BUG: 58847 M +13 -0 html_formimpl.cpp 1.417 --- kdelibs/khtml/html/html_formimpl.cpp #1.416:1.417 @@ -811,4 +811,17 @@ void HTMLGenericFormElementImpl::attach( } + // FIXME: This handles the case of a new form element being created by + // JavaScript and inserted inside a form. What it does not handle is + // a form element being moved from inside a form to outside, or from one + // inside one form to another. The reason this other case is hard to fix + // is that during parsing, we may have been passed a form that we are not + // inside, DOM-tree-wise. If so, it's hard for us to know when we should + // be removed from that form's element list. + if (!m_form) { + m_form = getForm(); + if (m_form) + m_form->registerFormElement(this); + } + NodeBaseImpl::attach();