Skip to main content

Bug Tracker

Side navigation

#7079 closed bug (duplicate)

Opened September 24, 2010 06:55PM UTC

Closed September 28, 2010 09:57PM UTC

Ajax load with selector does not load script tags

Reported by: LukeSheridan Owned by:
Priority: undecided Milestone: 1.4.3
Component: unfiled Version: 1.4.2
Keywords: Cc:
Blocked by: Blocking:
Description

If you have script tags on the target page, they will be loaded if you format your request like so:

div.load('/test.html');

However, if you use any selectors they will not be loaded:

div.load('/test.html body');

There is some comments in the code about doing that on purpose to avoid an IE permission denied errors but I could not find that bug or a test case that covered it.

I have attached a patch with a test and the change to make it pass.

Attachments (1)
Change History (2)

Changed September 28, 2010 09:44PM UTC by snover comment:1

need: ReviewTest Case

OK, so, I am trying to figure out exactly why $.fn.load strips scripts to begin with. The code says that it is to prevent “Permission denied” errors; I have not been able to actually find a source discussing this issue, or any test case. Reading MSDN’s innerHTML page says that scripts that are injected using innerHTML must have the DEFER flag set, and that they will be stripped if they are the first element in the string. Other than that, there is no indication that they should not work fine, so this normalizing behaviour is weird.

Changed September 28, 2010 09:57PM UTC by snover comment:2

resolution: → duplicate
status: newclosed

Duplicate of #6307.