Bug Tracker

Opened 11 years ago

Closed 10 years ago

Last modified 9 years ago

#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@…
Blocked by: Blocking:

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 (1)

jQueryTest.html (533 bytes) - added by doug316 11 years ago.
Test case HTML

Download all attachments as: .zip

Change History (6)

Changed 11 years ago by doug316

Attachment: jQueryTest.html added

Test case HTML

comment:1 Changed 11 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 11 years ago by dmethvin

Also see #4417; it looks like the problem does happen with double quotes too.

comment:3 Changed 10 years ago by dmethvin

Component: unfilledcore
Resolution: duplicate
Status: newclosed

Closing as a dup of #4417.

comment:5 Changed 10 years ago by vishvananda

Stumbled across this same problem. It still exists in 1.4

comment:6 Changed 9 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">

Note: See TracTickets for help on using tickets.