jQuery: The Write Less, Do More JavaScript Library

Ticket #1555 (new bug)

Opened 1 year ago

Last modified 8 months ago

automatic script evaluation

Reported by: fstorm Assigned to: john
Type: bug Priority: major
Milestone: 1.2 Component: ajax
Version: 1.1.4 Keywords:
Cc: Needs: Review

Description

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>");
	test_elem.html(test_script);
}

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 1.1.3.1 and 1.1.4 on my website.

Attachments

Change History

Changed 1 year ago by john

  • owner set to john

Changed 8 months ago by joern

  • component changed from core to ajax
Note: See TracTickets for help on using tickets.