Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#9416 closed bug (duplicate)

Clone() function is not able to parse a form within a form properly in IE7 - 9

Reported by: jjcrist@… Owned by: jjcrist@…
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 anonymous

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.

comment:2 Changed 12 years ago by Timmy Willison

Component: unfiledmanipulation
Owner: set to jjcrist@…
Priority: undecidedlow
Status: newpending

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 Changed 12 years ago by Rick Waldron

Wait, in the demo it says newer jQuery versions work?

comment:4 in reply to:  3 Changed 12 years ago by anonymous

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 anonymous

Here is the code running in jsfiddle.net (jquery v1.6):

http://jsfiddle.net/6Cm3y/2/

  • 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):

http://jsfiddle.net/6Cm3y/3/

Notice it is still not working.

comment:7 Changed 12 years ago by Rick Waldron

Resolution: duplicate
Status: pendingclosed

See also: #8086

comment:8 Changed 12 years ago by Rick Waldron

Duplicate of #6894.

Note: See TracTickets for help on using tickets.