#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 )
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 9 years ago by
Component: | General → HTML |
---|---|
Description: | modified (diff) |
Owner: | set to Eugene Lazutkin |
comment:2 Changed 9 years ago by
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 9 years ago by
I have the same problem. I just took example from http://dojotoolkit.org/reference-guide/dijit/layout.html#creation. Dojo.js is located localy. Wrapping code with dojo.addOnLoad fixed error.
comment:4 Changed 9 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
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 9 years ago by
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 9 years ago by
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 9 years ago by
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 9 years ago by
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 9 years ago by
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 http://dojotoolkit.org/reference-guide/1.7/quickstart/writingWidgets.html 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 9 years ago by
.. to be clear, win.doc.body() is returning undefined. The function IS defined.
comment:11 Changed 9 years ago by
Component: | HTML → Dijit |
---|
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 9 years ago by
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 9 years ago by
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 9 years ago by
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 are always triggered after the DOM is ready.
Thanks Bill.
It's working for us. Please attach a test case to this ticket and every ticket you file.