Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#14565 closed defect (invalid)

win.body() undefined

Reported by: acabler Owned by: Eugene Lazutkin
Priority: high Milestone: tbd
Component: Dijit Version: 1.7.1
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

Just migrated from 1.6.1 to 1.7.1. When I try to load, I get a typeerror: undefined from line 633 in dom-geometry. It looks like win.body() is undefined, but win.body is defined.

I am using Chrome 16.0.912

geom.isBodyLtr = function isBodyLtr(){
	return (win.body().dir || win.doc.documentElement.dir || "ltr").toLowerCase() == "ltr"; // Boolean

Change History (14)

comment:1 Changed 7 years ago by bill

Component: GeneralHTML
Description: modified (diff)
Owner: set to Eugene Lazutkin

It's working for us. Please attach a test case to this ticket and every ticket you file.

comment:2 Changed 7 years ago by acabler

At the moment, I have no way to send a testcase without sending my entire application, which I am unable to do.

When I do not have a testcase, would you prefer to not have bug reports in the future? I mean that as a serious question. I do understand the value of testcases.

comment:3 Changed 7 years ago by popatam

I have the same problem. I just took example from Dojo.js is located localy. Wrapping code with dojo.addOnLoad fixed error.

comment:4 Changed 7 years ago by bill

Resolution: invalid
Status: newclosed

Right, you need to do a dojo.ready() (nee dojo.addOnLoad()) or at least use the dojo/domReady! plugin before doing anything that accesses DOM nodes.

To answer @acabler's philosophical question, I don't think there's much value in filing a bug report when you can't make a test case. Maybe there are exceptional cases where it makes sense, but in general the ticket will just be closed.

comment:5 Changed 7 years ago by bill

PS: Your description in the ticket description was confusing to me, presumably what you meant was that win.body() was returning undefined (or null perhaps), not that the function itself didn't exist.

comment:6 Changed 7 years ago by Adam Peller

I've seen this on the latest Chrome also, but have not yet been able to produce an isolated test case. It's probably worth searching for a Chromium bug.

comment:7 Changed 7 years ago by swsimian

I run into this issue when my templated widget has a dijit.Dialog in the template. When I have time I should be able to reduce my setup to a test to include here, but mentioning it here in case it gives someone ideas. My thought: if dijit.Dialog is calling code that requires a ready, shouldn't it be taking care of it - or?

comment:8 Changed 7 years ago by bill

Yes, if Dialog were calling code that required a ready() then it should be handling it, but AFAIK there is no such code in Dialog.

comment:9 Changed 7 years ago by swsimian

Thanks bill.

I'm still looking through it, but I think I'm getting closer: _WidgetBase.buildRendering is calling this.isLeftToRight which seems to assume that the DOM is done. At least, win.doc.body() is undefined at the time causing this problem. My reading of tells me it isn't ready until postCreate. In my case, it is dijit.Dialog in a template that appears to have this problem. Still looking to reduce my code to a good test case. Is this the place to carry on this discussion or . . .?

comment:10 Changed 7 years ago by swsimian

.. to be clear, win.doc.body() is returning undefined. The function IS defined.

comment:11 Changed 7 years ago by bill

Component: HTMLDijit

Sure, we can continue the discussion here. I need to retract my previous statement. You are right that widgets assume the DOM is ready. The reference-guide says that you shouldn't instantiate widgets until dojo/ready. Sounds like you are trying to create your widget before that?

comment:12 Changed 7 years ago by swsimian

I'm configured to load sync with parseOnLoad. Let me see if this is happening during the parse or maybe I am triggering widget creation somewhere out side of that before DOM is ready.

comment:13 Changed 7 years ago by bill

Thanks. And to be clear, parseOnLoad: true should work correctly; if it's somehow triggering before the DOM is ready, that's a bug.

comment:14 Changed 7 years ago by swsimian

I believe that was it: To debug other issues, I put in a programmed creation of a widget unprotected by ready. So, bottom line for those with a similar issue as described here: Ensure your widgets are created after the DOM is ready.

Thanks Bill.

Last edited 7 years ago by swsimian (previous) (diff)
Note: See TracTickets for help on using tickets.