Skip to main content

Bug Tracker

Side navigation

#6941 closed bug (duplicate)

Opened August 24, 2010 08:13PM UTC

Closed December 13, 2010 07:22PM UTC

Last modified March 09, 2012 02:38AM UTC

.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:
Blocked by: Blocking:
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 (1)
Change History (10)

Changed August 26, 2010 01:00AM UTC by dmethvin comment:1

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.

Changed October 15, 2010 04:25AM UTC by snover comment:2

keywords: html script concathtml script concat needsreview
priority: → 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.

Changed October 16, 2010 02:21AM UTC by addyosmani comment:3

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

Changed November 05, 2010 02:07AM UTC by dmethvin comment:4

#6479 is a duplicate of this ticket.

Changed November 05, 2010 02:10AM UTC by dmethvin comment:5

#6458 is a duplicate of this ticket.

Changed November 05, 2010 02:11AM UTC by dmethvin comment:6

keywords: html script concat needsreviewhtml script concat
milestone: 1.4.31.5
status: newopen

Changed November 05, 2010 02:40AM UTC by dmethvin comment:7

#6417 is a duplicate of this ticket.

Changed November 23, 2010 01:01AM UTC by snover comment:8

#5954 is a duplicate of this ticket.

Changed December 13, 2010 07:22PM UTC by jitter comment:9

priority: undecidedhigh
resolution: → duplicate
status: openclosed

Changed December 13, 2010 07:22PM UTC by jitter comment:10

Duplicate of #6180.