id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	blocking	blockedby
6479	.load() not using right context	olafure	olafure	"Consider the following example of using jQuery (version 1.4.2) in a Firefox (version 3.6.3 on WinXP) in an extension.

--- code start ---

// contentDocument is the currently loaded web page DOM

$tmpData = jQuery('<div/>', contentDocument);

// We need to let jQuery use the XMLHttpRequest object from the contentDocument's window, otherwise we'll get ""Permission Denied"" error.

jQuery.extend(jQuery.ajaxSettings,
    {xhr: function() {
        return new contentDocument.defaultView.XMLHttpRequest();
    }
});

$tmpData.load('http://some.page.net/ p.interesting');

--- code end ---

Now, this doesn't work, because of line 4832, ""jQuery(""<div />"")""

That statement creates a temporary div tag to load the data into, but the div is creates in default context, which in a extension is the brower environment, not the webpage's.

If i modify the .load function:

load: function( url, params, callback, context ) {

and the line in question to:

jQuery(""<div />"", context)

Things start to work.

Now, perhaps I'm doing this in a too complex way, but unless there is a way to set the context when that temporary element is creates, it's a bug in my opinion :-)
"	bug	closed	undecided		ajax	1.4.2	duplicate				
