Skip to main content

Bug Tracker

Side navigation

#4352 closed enhancement (wontfix)

Opened March 14, 2009 08:10AM UTC

Closed November 17, 2010 03:06AM UTC

Support $("string") in XUL

Reported by: acoder Owned by:
Priority: minor Milestone: 1.4
Component: core Version: 1.3.2
Keywords: innerHTML XUL Cc:
Blocked by: Blocking:
Description

I'm using jQuery 1.3.2 in an Firefox extension but I keep getting the error "div is null" on line 940.

I'm loading jQuery like this in my chrome overlay:

<script type="application/x-javascript"

src="chrome://extensionname/content/jquery-1.3.2.js"/>

Attachments (3)
  • bug-4352-testcase.zip (36.8 KB) - added by dmachera April 23, 2009 11:30AM UTC.

    test case for #4352

  • screen-capture-1.png (43.6 KB) - added by jbownds April 08, 2009 02:51AM UTC.

    Error in line 940!

  • stack.rtf (33.8 KB) - added by jbownds April 28, 2009 07:20PM UTC.

    Contents of variable named "stack" returned with error when I try/catch jqueryUI stuff.

Change History (10)

Changed March 14, 2009 02:06PM UTC by dmethvin comment:1

Can you provide a complete test case? It's not possible to reproduce the problem with only the information provided.

Changed March 15, 2009 05:39PM UTC by acoder comment:2

I can no longer reproduce the error so you should probably close this bug.

Changed April 08, 2009 02:50AM UTC by jbownds comment:3

I'm experiencing the same thing. It's limited to the use of jquery UI functions. So, for example,

Add a wrapper:

foo.wrapper= $('<div id="foo">').appendTo(masthead).html(" ");

Pull in some html. . no problem.

$(foo.wrapper).load("http://foobar.com/foo.html", "", rebind);

Add some CSS in the callback (rebind), no problem.

$(foo.wrapper).css("border","3px solid red");

Fade the Div out in the callback, no problem.

$(serum.wrapper).fadeOut("slow");

Do anything at all related to jqueryUI, and bork. The attached error can be caught (see attached image), but if the statement isn't wrapped in a try catch, everything just dies.

$(serum.wrapper).accordion(); Nogo.

$(serum.wrapper).tabs(); / Same problem.

We're calling 1.3.2 in the chrome overlay as well, but from a remote spot. I've tried calling it from different locations (the hosted Google instances here: http:code.google.com/apis/ajaxlibs/documentation/index.html#jquery for example) and run into the same issue.

Changed April 08, 2009 05:24PM UTC by jbownds comment:4

Worthy of note. . When I run the nightly build instead of 1.3.2, this problem is resolved. I've confirmed by toggling between builds that the issue has been resolved somewhere between 1.3.2 and the head. .

Changed April 16, 2009 08:56PM UTC by jhilden comment:5

I have the same issue trying to use .append() in my extension with jQuery 1.3.2

Changed April 23, 2009 11:32AM UTC by dmachera comment:6

This bug seems to exist in both the 1.3.2 and nightly (2009-03-22 21:55:17 -0400 (Sun, 22 Mar 2009)) releases.

To replicate this bug it is probably worthwhile to set up a firefox extension environment (https://developer.mozilla.org/en/Setting_up_extension_development_environment)

Unzip the attached test-case (bug-4352-testcase.zip), then create a file called 'bug-4352@dev.jquery.com' with the contents being the full path to this test-case i.e. '/home/dan/bug-4352/', make sure to place this file in your mozilla extensions directory

The bug is exposed on line 9 of bug-4352.js, which causes line 940 of jquery (1.3.2) to output 'div is null' to the error console, here is the jquery line throwing the error:

elem = jQuery.makeArray(div.childNodes);

If any more info is required, ask away.

Ta

Changed April 28, 2009 07:18PM UTC by jbownds comment:7

Alas- I'm running into this again. This time in line 2304, not sure if the line is significant. Tried updating to a nightly build, still fails. I'll attach the stack returned when I capture the error with a try/catch.

Changed April 28, 2009 07:28PM UTC by jbownds comment:8

Worthy of note. .

Line 2304, where the code fails, is

elem = jQuery.makeArray(div.childNodes);

(see dmachera's comment above. . )

Changed May 10, 2009 01:54PM UTC by dmethvin comment:9

component: unfilledcore
keywords: → innerHTML XUL
priority: criticalminor
summary: "div is null" when used with XULSupport $("string") in XUL
type: bugenhancement

The

$(html)
constructor is meant to parse HTML (not XML or XUL):

http://docs.jquery.com/Core/jQuery#htmlownerDocument

jQuery uses the

innerHTML
property of a div to convert an HTML string to DOM nodes. It doesn't appear that XUL supports
innerHTML
so you can't use
$(html)
and would need to create the nodes via DOM or a plugin. Here's what I found:

http://digitalmihailo.blogspot.com/2008/05/jquery-and-dynamic-html-in-xul.html

http://www.scribd.com/doc/88692/jeff-griffithsphp-xul-jquery

I've edited this ticket to change it to an enhancement request.

Changed November 17, 2010 03:06AM UTC by dmethvin comment:10

resolution: → wontfix
status: newclosed

This doesn't seem like a feature we'd ever include in core; the best way to support this would be through a XUL plugin.