I\'m trying to use jQuery inside a Firefox extension, and actually want to use jQuery to manipulate the DOM of the current page, as opposed to the context of the XUL file. T
.trim(), .ajax() etc are static methods, meaning they are bound to the jQuery constructor and not it's prototype.
jQuery.noConflict();
$ = function(selector,context){ return new jQuery.fn.init(selector,context||example.doc); };
$.fn = $.prototype = jQuery.fn;
jQuery.extend($, jQuery); // copy's trim, extend etc to $
However a perhaps nice way is to leave jQuery intact and do the following:
var fromDoc = $(document);
// and if you want to find stuff:
fromDoc.find('div').doSomething();
fromDoc.find('.someClass').doSomethingElse();
This is also an optimisation since the context doesnt have to be manually set anymore with each query.