Bug Tracker

Modify

Ticket #6941 (closed bug: duplicate)

Opened 3 years ago

Last modified 15 months ago

.html moves script tags when it doesn't remove them

Reported by: lathan Owned by:
Priority: high Milestone: 1.5
Component: manipulation Version: 1.4.2
Keywords: html script concat Cc:
Blocking: Blocked by:

Description

If you set the html of an element with a script type="text/template", jQuery does not remove it, but it moves it up to the root node that's being added.

This is caused by the .concat(....) on line 4498 of jQuery 1.4.2, (non mimified) in the function clean.

I have been unable to find the reason that all script tags are moved to the root of the DOMfragment.

Solution: remove the .concat(...) from line 4498 in the clean function.

If anyone can tell me a reason for this statement to be there, I will gladly be quiet, but I have been unable to find a reason, including on the jQuery IRC channel.

Attachments

script-test.html Download (595 bytes) - added by lathan 3 years ago.

Change History

Changed 3 years ago by lathan

comment:1 Changed 3 years ago by dmethvin

I think this may have been due to an earlier fix. The code used to remove all scripts but was changed to only remove text/javascript. When they all were being removed it didn't matter.

So it seems like to keep the scripts at the same position we would need to run through the children looking for scripts rather than using getElementsByTagName.

comment:2 Changed 3 years ago by snover

  • Keywords needsreview added
  • Priority set to undecided

We should probably revisit the current script evaluation stuff at some point since it seems it may be causing more trouble than it solves. Marking for review.

comment:3 Changed 3 years ago by addyosmani

I've added this as something to review in the Architectural issues document. Hopefully we can review further there.

comment:4 Changed 3 years ago by dmethvin

#6479 is a duplicate of this ticket.

comment:5 Changed 3 years ago by dmethvin

#6458 is a duplicate of this ticket.

comment:6 Changed 3 years ago by dmethvin

  • Keywords needsreview removed
  • Status changed from new to open
  • Milestone changed from 1.4.3 to 1.5

comment:7 Changed 3 years ago by dmethvin

#6417 is a duplicate of this ticket.

comment:8 Changed 2 years ago by snover

#5954 is a duplicate of this ticket.

comment:9 Changed 2 years ago by jitter

  • Priority changed from undecided to high
  • Status changed from open to closed
  • Resolution set to duplicate

comment:10 Changed 2 years ago by jitter

Duplicate of #6180.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.