this.body.firstChild is null or not an object thrown from menu.js

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

this.body.firstChild is null or not an object thrown from menu.js

Adrian Baker-3
Upgrading to the 10 June nightly, I'm having trouble getting a YUI menu running on Orbeon pages. Previously this worked fine.

The error occurs in both FF 3.0 and IE7, in http://developer.yahoo.com/yui/docs/menu.js.html at this line:

oNode = this.body.firstChild;

Has anyone else seen this problem?
Reply | Threaded
Open this post in threaded view
|

Re: this.body.firstChild is null or not an object thrown from menu.js

Adrian Baker-3
The problem seems to go away if I initialise my menu from onContentReady, rather than onDOMReady.

No idea why, and why this started happening in the newer Orbeon version though.

Adrian Baker wrote
Upgrading to the 10 June nightly, I'm having trouble getting a YUI menu running on Orbeon pages. Previously this worked fine.

The error occurs in both FF 3.0 and IE7, in http://developer.yahoo.com/yui/docs/menu.js.html at this line:

oNode = this.body.firstChild;

Has anyone else seen this problem?
Reply | Threaded
Open this post in threaded view
|

Re: this.body.firstChild is null or not an object thrown from menu.js

Adrian Baker-3
... I spoke to soon, my onContentReady handler was never running. No matter when run, the error occurs, even if I trigger the menu creation once the page has loaded, in an onclick handler.

Adrian Baker wrote
The problem seems to go away if I initialise my menu from onContentReady, rather than onDOMReady.

No idea why, and why this started happening in the newer Orbeon version though.

Adrian Baker wrote
Upgrading to the 10 June nightly, I'm having trouble getting a YUI menu running on Orbeon pages. Previously this worked fine.

The error occurs in both FF 3.0 and IE7, in http://developer.yahoo.com/yui/docs/menu.js.html at this line:

oNode = this.body.firstChild;

Has anyone else seen this problem?
Reply | Threaded
Open this post in threaded view
|

Re: this.body.firstChild is null or not an object thrown from menu.js

Alessandro Vernet
Administrator
In reply to this post by Adrian Baker-3
Hi Adrian,

Adrian Baker wrote
Upgrading to the 10 June nightly, I'm having trouble getting a YUI menu running on Orbeon pages. Previously this worked fine.

The error occurs in both FF 3.0 and IE7, in http://developer.yahoo.com/yui/docs/menu.js.html at this line:

oNode = this.body.firstChild;

Has anyone else seen this problem?
I don't have this problem when running this sandbox example:

http://localhost:8080/orbeon/xforms-sandbox/sample/menu

Do you get the error with this sandbox example? If not, how can we reproduce the error you are getting? (As usual, an example that runs in the XForms sandbox makes it easier for us.)

Alex
Reply | Threaded
Open this post in threaded view
|

Re: this.body.firstChild is null or not an object thrown from menu.js

Adrian Baker-3
That works for me. Try html-area.xhtml. The javascript is re-imported from YUI, perhaps that's the issue.

Alessandro Vernet wrote
Hi Adrian,

Adrian Baker wrote
Upgrading to the 10 June nightly, I'm having trouble getting a YUI menu running on Orbeon pages. Previously this worked fine.

The error occurs in both FF 3.0 and IE7, in http://developer.yahoo.com/yui/docs/menu.js.html at this line:

oNode = this.body.firstChild;

Has anyone else seen this problem?
I don't have this problem when running this sandbox example:

http://localhost:8080/orbeon/xforms-sandbox/sample/menu

Do you get the error with this sandbox example? If not, how can we reproduce the error you are getting? (As usual, an example that runs in the XForms sandbox makes it easier for us.)

Alex
html-area.xhtml
Reply | Threaded
Open this post in threaded view
|

Re: this.body.firstChild is null or not an object thrown from menu.js

Alessandro Vernet
Administrator
Adrian Baker wrote
That works for me. Try html-area.xhtml. The javascript is re-imported from YUI, perhaps that's the issue.
I just tried running the file you attached in the sandbox with Firefox 3.0, and don't get any error. Quid?

Alex
Reply | Threaded
Open this post in threaded view
|

Re: this.body.firstChild is null or not an object thrown from menu.js

Adrian Baker-3
Really? How about IE7 (haven't tried IE8) ?

Alessandro Vernet wrote
Adrian Baker wrote
That works for me. Try html-area.xhtml. The javascript is re-imported from YUI, perhaps that's the issue.
I just tried running the file you attached in the sandbox with Firefox 3.0, and don't get any error. Quid?

Alex
Reply | Threaded
Open this post in threaded view
|

Re: this.body.firstChild is null or not an object thrown from menu.js

Adrian Baker-3
In reply to this post by Alessandro Vernet
Nothing is reported in the console in firefox? I've just had someone else try it on http://www.orbeon.com/ops/xforms-sandbox/ using FF 3 and they get an error.

Alessandro Vernet wrote
Adrian Baker wrote
That works for me. Try html-area.xhtml. The javascript is re-imported from YUI, perhaps that's the issue.
I just tried running the file you attached in the sandbox with Firefox 3.0, and don't get any error. Quid?

Alex
Reply | Threaded
Open this post in threaded view
|

Re: this.body.firstChild is null or not an object thrown from menu.js

Alessandro Vernet
Administrator
Adrian,

Adrian Baker wrote
Nothing is reported in the console in firefox? I've just had someone else try it on http://www.orbeon.com/ops/xforms-sandbox/ using FF 3 and they get an error.
Ah! My fault: I opened the wrong file. However you don't need to using the XForms menu control in this example. You are creating your own YUI menu. And I get the same error removing everything related to XForms. See: http://pastie.org/509244

Am I missing something?

Alex

Reply | Threaded
Open this post in threaded view
|

Re: this.body.firstChild is null or not an object thrown from menu.js

Adrian Baker-3
Sorry yes I should have been clearer.

We use a number of non-XForms bits (pure HTML+Javascript) of YUI on our pages, one of them based on the YUI menu - the one that now fails to init when I upgraded to 3.7.1. So something in Orbeon seems to be stopping the YUI menu library from working correctly when invoked directly (something new since January).

http://pastie.org/509244 works without errors if I save to disk and load in browser... ?

Alessandro Vernet wrote
Adrian,

Adrian Baker wrote
Nothing is reported in the console in firefox? I've just had someone else try it on http://www.orbeon.com/ops/xforms-sandbox/ using FF 3 and they get an error.
Ah! My fault: I opened the wrong file. However you don't need to using the XForms menu control in this example. You are creating your own YUI menu. And I get the same error removing everything related to XForms. See: http://pastie.org/509244

Am I missing something?

Alex
Reply | Threaded
Open this post in threaded view
|

Re: this.body.firstChild is null or not an object thrown from menu.js

Alessandro Vernet
Administrator
Adrian,

Adrian Baker wrote
Sorry yes I should have been clearer.

We use a number of non-XForms bits (pure HTML+Javascript) of YUI on our pages, one of them based on the YUI menu - the one that now fails to init when I upgraded to 3.7.1. So something in Orbeon seems to be stopping the YUI menu library from working correctly when invoked directly (something new since January).

http://pastie.org/509244 works without errors if I save to disk and load in browser... ?
Yes, I did get the same error, but this is because my Firebug was set to break on all errors.



Maybe the error always happened, but before was silently ignored. We change some of our code not to silently ignore exceptions, and asked YUI to do the same (with a YAHOO.util.Event.throwErrors = true). If you enable this setting in your Firebug, do you also get the error when running the above example which is independent from Orbeon Forms? If you do, then I guess you can take it from there.

Alex
Reply | Threaded
Open this post in threaded view
|

Re: this.body.firstChild is null or not an object thrown from menu.js

Adrian Baker-3
Hi Alex,

You are right, explicitly setting YAHOO.util.Event.throwErrors to false seems to 'mask' the error, and restore things to a working state. Thanks!

However, I do still believe this (probably pre-existing) error is specific to Orbeon pages.

I'm still not able to see it in the standalone HTML file (even if I set YAHOO.util.Event.throwErrors to true) - although my Firebug doesn't seem offer the break-on-errors setting (1.3.3 on FF 3.0.10, MS Vista), it still doesn't log anything in the console, whereas on the Orbeon page it does. In addition, IE reports nothing on this page, whereas on the Orbeon page I get an script error popup (IE is set to pop up errors).

...wouldn't it be surprising if it *did* report an error, considering that page is nothing more than a standard invocation of the YUI library?

Adrian

Alessandro Vernet wrote
Adrian,

Adrian Baker wrote
Sorry yes I should have been clearer.

We use a number of non-XForms bits (pure HTML+Javascript) of YUI on our pages, one of them based on the YUI menu - the one that now fails to init when I upgraded to 3.7.1. So something in Orbeon seems to be stopping the YUI menu library from working correctly when invoked directly (something new since January).

http://pastie.org/509244 works without errors if I save to disk and load in browser... ?
Yes, I did get the same error, but this is because my Firebug was set to break on all errors.



Maybe the error always happened, but before was silently ignored. We change some of our code not to silently ignore exceptions, and asked YUI to do the same (with a YAHOO.util.Event.throwErrors = true). If you enable this setting in your Firebug, do you also get the error when running the above example which is independent from Orbeon Forms? If you do, then I guess you can take it from there.

Alex
Reply | Threaded
Open this post in threaded view
|

Re: this.body.firstChild is null or not an object thrown from menu.js

Alessandro Vernet
Administrator
Hi Adrian,

Adrian Baker wrote
I'm still not able to see it in the standalone HTML file (even if I set YAHOO.util.Event.throwErrors to true) - although my Firebug doesn't seem offer the break-on-errors setting (1.3.3 on FF 3.0.10, MS Vista), it still doesn't log anything in the console, whereas on the Orbeon page it does. In addition, IE reports nothing on this page, whereas on the Orbeon page I get an script error popup (IE is set to pop up errors).
(Sorry for the late response!)

Maybe that break-on-errors setting is in a slightly different place in Firebug 1.3. The screenshot was with Firebug 1.4. If you're on Firefox 3.0 (instead of 3.5) you need to download the beta versions manually; see: http://antennasoft.net/robcee/2009/06/03/firebug-140b1-limited-release-on-amo/

Now, this being said, try removing the <div id="my-yui-menu"/> from the markup. Doing so, I don't get the JS error anymore, and looking at a YUI example where they build the menu from JavaScript (instead of markup), they don't have the div in the markup beforehand (http://developer.yahoo.com/yui/examples/menu/example02_clean.html).

Alex