Ticket #4422 (closed bug: duplicate)
Clone under IE8 - form with trailing / in action
| Reported by: | doug316 | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | |
| Component: | core | Version: | 1.2.6 |
| Keywords: | ie8 form clone | Cc: | doug316@… |
| Blocking: | Blocked by: |
Description
IE8 version 8.0.6001.18702
When cloning a form in IE8 with a trailing slash in the action, the form opening tag is incorrectly treated as an open/close tag. Its children are treated as children of the form's parent rather than the form, and the original form close tag is without a matching open.
Using the included code, view the HTML under IE8, and then browse the DOM. Within '#div2 .contents form ' you'll notice that there are no inputs, and that the inputs are children of the parent '.contents'. Compare with #div1.
When I browse the code using IE DebugBar, the quotes on the action do not appear and the trailing slash immediately precedes the closing >.
Remove the trailing slash from the action, and the bug no long occurs.
Attachments
Change History
Changed 4 years ago by doug316
-
attachment
jQueryTest.html
added
comment:1 Changed 4 years ago by dmethvin
Oooh, that's a good one.
I don't have IE8 handy on this system...If you dump out $("#contents").html() does the form tag look something like this, i.e., with your quotes stripped?
<form class=form1 action=blah/>
As part of another IE workaround, jQuery uses .html() in .clone() so if the quotes are stripped out by IE it is generating bad HTML.
Does the same thing happen if you use double quotes?
comment:2 Changed 4 years ago by dmethvin
Also see #4417; it looks like the problem does happen with double quotes too.
comment:3 Changed 4 years ago by dmethvin
- Status changed from new to closed
- Resolution set to duplicate
- Component changed from unfilled to core
Closing as a dup of #4417.
comment:5 Changed 3 years ago by vishvananda
Stumbled across this same problem. It still exists in 1.4
comment:6 Changed 2 years ago by anonymous
source:
<div id="dialog_template" style="display: none;">
<form action="/restaurants/" method="POST">
<input name="query_reserve" value="true" type="hidden"/> <input name="address" value="" type="hidden"/> <input name="reserve" value="" type="hidden"/>
...
</form>
</div>
code:
dialog_template = jQuery("#dialog_template").html(); jQuery("#dialog_template").remove();
result in ie8: <FORM method=post action=/restaurants></FORM><INPUT name=query_reserve value=true type=hidden> <INPUT name=address type=hidden> ... </FORM>
bug fixes: change action to <form action="/restaurants" method="POST">
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Test case HTML