Fix #6137, dialog('open') causes form elements to reset on IE7.#24
Fix #6137, dialog('open') causes form elements to reset on IE7.#24jfirebaugh wants to merge 1 commit into
Conversation
Looking through the history, the behavior of appending to the body was present in the initial commit without explanation. The only substantive change thereafter was adding the next().length check in fbdb9f0, fixing #3012. uiDialog is already appended to the body in _create, and doing it again in open seems only to cause problems. Removing it does not cause any test regressions.
|
I'm pretty sure the IE6 thing is a myth. Dialogs are appended to the end of the body to ensure the z-index works as expected (by avoiding nested stacking contexts) in all browsers. It's entirely possible that there's some bug in IE6 that we're trying to avoid, but changing positions within the same parent isn't it. I'm almost positive that this code used to just blindly append the dialog to the body. Somebody complained, filed a ticket, gave a decent reason why we didn't need to do that and we went with something more conservative, which is what we have today. I believe the reasoning was that we can assume the dialog is already a direct child of the body (because we put it there) and therefore we can just worry about the one thing we're actually concerned with, which is making it the last child. However, as I've said, this isn't a real problem. In fact, if it were, the moveToTop method would be broken as all it does is change z-indexes. I think it's safe to land this patch. |
|
I just put together a test page with two dialogs with the three lines commented out. The following occurs in the test:
Dialog 1 appears on top of dialog 2, even though it comes earlier in the DOM. Clicking on dialog 2 brings it to the front, then clicking on dialog 1 brings it to the front. |
|
Heh, while I was committing your fix, I saw your full commit message which explained the history that I was trying to recall from memory :-) Thanks for digging into this and fixing it. Landed in e66cdfc. |
See http://dev.jqueryui.com/ticket/6137 and commit message for details.