var head = doc.getElementsByTagName("head")[0] || doc.documentElement;
??? On Thu, Jul 23, 2009 at 11:42 PM, Gaël Pasgrimaud <gael.pasgrim...@gmail.com > wrote: > > Hi, > > I'm using jQuery in a Firefox extension to modify the current > document. It work great. > I only have problems with ajax request. > > When you use getJSON in a FF extension the document object has no > <head /> but jQuery try to use it to add a <script /> tag. > The problem is located in the $.ajax() function. > > The patch bellow fix the problem: > > % diff jquery-1.3.2.js apwalfr/content/jquery.js > 3433c3433,3434 > < window[ jsonp ] = function(tmp){ > --- > > var w = window.content.document.wrappedJSObject ? > window.content.window.wrappedJSObject : window; > > w[ jsonp ] = function(tmp){ > 3438,3439c3439,3440 > < window[ jsonp ] = undefined; > < try{ delete window[ jsonp ]; } catch(e) > {} > --- > > w[ jsonp ] = undefined; > > try{ delete w[ jsonp ]; } catch(e){} > 3476,3477c3477,3479 > < var head = document.getElementsByTagName > ("head")[0]; > < var script = document.createElement("script"); > --- > > var doc = window.content.document.wrappedJSObject ? > window.content.document : document; > > var head = doc.getElementsByTagName("head")[0]; > > var script = doc.createElement("script"); > > This way jQuery use the current window / document to add the <script > /> tag and everything work fine. > > Don't know if this is 100% OK for all browsers but AFAIK > window.content.document.wrappedJSObject is only defined when you are > in a FF extension. > > Hope someone can improve and apply this patch. > > Regards, > > Gael > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---