#9416 closed bug (duplicate)
Clone() function is not able to parse a form within a form properly in IE7 - 9
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | low | Milestone: | 1.next |
Component: | manipulation | Version: | 1.6.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
The following code illustrates the issue. Note: This is particularly an issue with ASP.NET Forms, where all pages generated are surrounded with a form. IF the user has a form within the asp page, they are likely to have a similar issue.
<!DOCTYPE> <html> <head> <!-- OVERVIEW: jquery 1.5.0 Clone() function is not able to parse a form within a form properly in IE7 - 9 (not tested in IE6) INSTRUCTIONS: Change the jquery version to 1.5.0 to see the issue and compare it with 1.4.4 latest version doesn't work <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.js" type="text/javascript"></script> 1st version that introduces issue <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.js" type="text/javascript"></script> ERROR: Message: 'nodeType' is null or not an object Line: 5332 Char: 2 Code: 0 URI: https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.js --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.js" type="text/javascript"></script> </head> <body> <form><!--comment out this form tag to see it work properly with the newer jquery versions--> <a href="" class="a">Print</a> <div id="contents"> <form></form> <div></div> </div> <textarea id="y" cols="50" rows="20"></textarea> <textarea id="z" cols="50" rows="20"></textarea> </form><!--comment out this form tag to see it work properly with the newer jquery versions--> <script> $("a.a").click(function(e) { e.preventDefault(); $('#y').val($('#contents').html()); $('#z').val($('#contents').clone().html()); }); </script> </body> </html>
Change History (8)
comment:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
Component: | unfiled → manipulation |
---|---|
Owner: | set to jjcrist@… |
Priority: | undecided → low |
Status: | new → pending |
Thanks for taking the time to contribute to the jQuery project! Please provide a reduced test case on http://jsfiddle.net that reproduces the issue experienced to help us assess your ticket.
Additionally, test against the jQuery (edge) version to ensure the issue still exists.
comment:3 follow-up: 4 Changed 12 years ago by
Wait, in the demo it says newer jQuery versions work?
comment:4 Changed 12 years ago by
Replying to rwaldron:
Wait, in the demo it says newer jQuery versions work?
Not sure what you are referring to. I said in numerous places that jQuery v1.5.0 and up do not work with the example code attached to this ticket.
jQuery 1.4.4 will work. Therefore, the issue was introduced in v1.5.0.
I hope this clears things up :)
comment:5 Changed 12 years ago by
Here is the code running in jsfiddle.net (jquery v1.6):
- click the 'Print' link to view how the results using the html() function compared to the clone() function.
Notice it's working for the html() function but the clone() function returns an error. Again, this was produced using IE 7 - 9.
Here it is using the jquery (edge):
Notice it is still not working.
Like I mentioned in the comments of the code, this is not an issue in jquery v1.4.4. It was introduced in v1.5.0 and is still an issue in v1.6.1.