Bug Tracker

Opened 13 years ago

Closed 11 years ago

#1555 closed bug (duplicate)

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.

Change History (4)

comment:1 Changed 13 years ago by john

Owner: set to john

comment:2 Changed 12 years ago by joern

Component: coreajax

comment:3 Changed 11 years ago by dmethvin

Keywords: script added
Summary: automatic script evaluationScripts execute before being put into the document

See also #3105

comment:4 Changed 11 years ago by brandon

Resolution: duplicate
Status: newclosed

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

Note: See TracTickets for help on using tickets.