Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#18359 closed defect (invalid)

dojo.js guardCheckComplete throw exception when defining customized widget on IE8

Reported by: split Owned by: split
Priority: undecided Milestone: 1.11
Component: Core Version: 1.10.2
Keywords: Cc:
Blocked By: Blocking:

Description

I created a custom widget DateTimeTextBox?, and then require[<my widget>]. It works perfectly on Firefox, Chrome and IE11.

Howeveron IE8, the function guardCheckComplete in dojo.js will always throw an exception every "first" time on the page. It works fine if I try to require[<my widget>] again on the same web page on IE8. Please see my attachment.

Attachments (2)

dojo_require_imcompatiable_ie8.zip (2.3 KB) - added by split 6 years ago.
aync.jpg (121.1 KB) - added by split 6 years ago.

Download all attachments as: .zip

Change History (8)

Changed 6 years ago by split

comment:1 Changed 6 years ago by dylan

Owner: set to split
Status: newpending

Have you set async:true in your data-dojo-config ? Because your example doesn't show that you're using the async loader. Also, I'd highly recommend using the HTML5 doctype to prevent this from kicking you into compat mode in IE8.

Changed 6 years ago by split

Attachment: aync.jpg added

comment:2 Changed 6 years ago by split

Status: pendingnew

Attachment (aync.jpg) added by ticket reporter.

comment:3 Changed 6 years ago by split

I tried to set async to true, false or "legacyAsync", but guardCheckComplete still throw exceptions in all three modes.

comment:4 Changed 6 years ago by dylan

Milestone: tbd1.11
Resolution: invalid
Status: newclosed

There are a number of imperfections in your code, a number of which could be causing the issue.

Your screenshot shows you running from the local file system rather than from a web server. You should always run all code from a web server, even if that server is on your local machine. See http://www.sitepen.com/blog/2014/07/30/dojo-faq-why-do-i-need-to-use-an-http-server-with-dojo/

In your code itself:

myCalendar/_DateTimeTextBoxPopup.js

  • Line 13 should be:

var _DateTimeTextBoxPopup = declare([_Widget, _TemplatedMixin], {

Also, why are you using _Widget instead of _WidgetBase?

  • Line 15:

baseClass: "dijitTextBox dijitComboBox dijitDateTextBox platfromCalendar",

Do you really have a class called platfromCalendar? You've not provided the CSS for your widget.

  • Lines 33 and 37:

this._calendarComponent.destory(); should be this._calendarComponent.destroy();

  • Line 68

Why are you using dojo.connect instead of pulling in dojo/on as a dependency?

myCalendar/DateTimeTextBox.js

  • Line 7 should be:

return declare(_DateTimeTextBox, {

myCalendarTest.htm:

  • I would suggest using the HTML5 doctype to not put a browser into compat or quirks mode
  • You have hardcoded firefox specific class names into your HTML tag, dj_gecko dj_ff31 dj_contentbox
  • language="javascript" type="text/javascript" is unnecessary
  • We recommend moving your script to the bottom of the BODY tag
  • You're requiring the parser, but you have no widgets to parse, so that's not necessary

That said, I don't think this is a bug, but a support question, so please clean up the code and then ask on dojo-interest, http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

comment:5 Changed 6 years ago by dylan

P.S. Your screenshot is cutting off line numbers on the far right that would tell you which lines of your custom code are actually causing the errors you are seeing in IE8.

comment:6 Changed 6 years ago by split

After applying your suggestions, my codes work fine now. Thank you very much, Dylan.

BTW, I found that the root cause is dojo.connect. If the old-style dojo.connect is used in my widget, the dojo.js will throw exception during requiring.

Note: See TracTickets for help on using tickets.