Skip to main content

Bug Tracker

Side navigation

#1555 closed bug (duplicate)

Opened August 30, 2007 02:00PM UTC

Closed March 18, 2009 03:37AM UTC

Scripts execute before being put into the document

Reported by: fstorm Owned by: john
Priority: major Milestone: 1.2
Component: ajax Version: 1.1.4
Keywords: script Cc:
Blocked by: Blocking:

In jQuery 1.1.4 scripts get automatically evaluated when they're attached to the DOM. But they're also evaluated when they're attached to elements which are not part of the document DOM yet.

I think scripts shouldn't be evaluated until they're attached to the document DOM.

Simple test:

function test()
	var test_script = "<script type=\\"text/javascript\\">alert(\\"hello!\\");</script>";

	var test_elem = jQuery("<div></div>");


When executed, this function displays the alert "hello!". I think it shouldn't unless you insert test_elem into the document DOM.

This breaks compatibility between and 1.1.4 on my website.

Attachments (0)
Change History (4)

Changed August 30, 2007 10:38PM UTC by john comment:1

owner: → john

Changed December 06, 2007 08:36PM UTC by joern comment:2

component: coreajax

Changed January 18, 2009 04:02AM UTC by dmethvin comment:3

keywords: → script
summary: automatic script evaluationScripts execute before being put into the document

See also #3105

Changed March 18, 2009 03:37AM UTC by brandon comment:4

resolution: → duplicate
status: newclosed

going to go ahead and close this as a duplicate of #3105 to conslidate