Fix issue with parentNode as null, fixes #18130

This is a bug in the iframe handler for corner-cases of a form element being detached from the document when it is passed into the iframe handler.  The do/while loop should check that parentNode is not null in its search-back loop to avoid a parentNode is null error.  This is related to defect:

https://bugs.dojotoolkit.org/ticket/18130#ticket