Skip to main content

Bug Tracker

Side navigation

#6180 closed bug (fixed)

Opened February 26, 2010 01:43PM UTC

Closed April 12, 2011 08:40PM UTC

Last modified March 09, 2012 02:52PM UTC

jQuery.clean should not touch script tags that are not of type text/javascript

Reported by: rio Owned by: rjgotten
Priority: high Milestone: 1.6
Component: manipulation Version: 1.5
Keywords: Cc:
Blocked by: Blocking:
Description

At the very end of the clean function script tag nodes embedded in the nodes stored in the ret array are spliced into the ret array itself.

The clean function should not touch those scripts with a type different from "text/javascript" (e.g. custom types used for script island metadata). This check is partially in place, but still missing from:

ret.splice.apply(ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );

The direct use of getElementsByTagName() causes all non-"text/javascript" script tags to be moved to direct children of fragment. If this is combined with temporary container nodes (e.g. the Blind effect in jQuery UI) this causes those script tags to be 'eaten'.

A simple fix is $.grep()-ing the result from getElementsByTagName and only retaining those script elements with the "text/javascript" type.

Attachments (0)
Change History (11)

Changed October 17, 2010 03:50PM UTC by rjgotten comment:1

Created a jsFiddle which demonstrates the problem present in jQuery 1.4.3: http://jsfiddle.net/3S8Kx/

And created a patch to manipulation.js:

http://github.com/rjgotten/jquery/commit/df7dfc2404807dce2f97c21782eb3a14ced86d6b

Changed October 18, 2010 10:21PM UTC by snover comment:2

milestone: 1.4.21.5
priority: → high
status: newopen
version: 1.4.11.4.3

Changed November 21, 2010 11:01PM UTC by snover comment:3

3rd party pull request

Changed December 13, 2010 01:14AM UTC by jitter comment:4

#7586 is a duplicate of this ticket.

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

#6941 is a duplicate of this ticket.

Changed February 05, 2011 01:00AM UTC by jitter comment:6

#6765 is a duplicate of this ticket.

Changed February 05, 2011 01:02AM UTC by jitter comment:7

milestone: → 1.next
owner: → rjgotten
status: openassigned
version: 1.4.31.5

This comment on #6765 might deserve some attention when considering to fix this bug.

Changed March 09, 2011 02:08PM UTC by rwaldron comment:8

#8483 is a duplicate of this ticket.

Changed April 01, 2011 11:18PM UTC by rwaldron comment:9

#8749 is a duplicate of this ticket.

Changed April 12, 2011 08:40PM UTC by John Resig comment:10

resolution: → fixed
status: assignedclosed

Merge branch 'master' of https://github.com/rjgotten/jquery into rjgotten-master. Also added in unit tests covering the case. Fixes #6180.

Conflicts:

src/manipulation.js

Changeset: 3418f323876043db63a2da9f653e51d5458647fa

Changed April 12, 2011 08:40PM UTC by john comment:11

milestone: 1.next1.6