Bug Tracker

Opened 9 years ago

Closed 9 years ago

#7079 closed bug (duplicate)

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)

0001-load-action.patch (1.5 KB) - added by LukeSheridan 9 years ago.
patch

Download all attachments as: .zip

Change History (3)

Changed 9 years ago by LukeSheridan

Attachment: 0001-load-action.patch added

patch

comment:1 Changed 9 years ago by snover

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.

comment:2 Changed 9 years ago by snover

Resolution: duplicate
Status: newclosed

Duplicate of #6307.

Note: See TracTickets for help on using tickets.