Opened 15 years ago

Closed 15 years ago

Last modified 14 years ago

#3434 closed defect (fixed)

Calendar: IE throws exception when using innerHTML property of element(s)

Reported by: guest Owned by: Adam Peller
Priority: high Milestone: 0.9
Component: Dijit Version: 0.4.2rc1
Keywords: innerHTML IE Unknown Exception Cc:
Blocked By: Blocking:


Within DatePicker?.js there are multiple occurrences of setting the innerHTML property of an element, however, in Internet Explorer, this sometimes throws an Unknown Runtime Error and/or Exception. I had to alter the _initUI, _setMonthLabel, and _setYearLabels functions to stop the error. (There may be more occurrences, I just don't have time to track them all down)

_setMonthLabel:function (monthIndex) {

dojo.dom.removeChildren(this.monthLabelNode); this.monthLabelNode.appendChild(document.createTextNode("months", "wide", "standAlone", this.lang)[monthIndex]));


_setYearLabels:function (year) {

var y = year - 1; var that = this; function f(n) {

dojo.dom.removeChildren(that[n + "YearLabelNode?"]); that[n + "YearLabelNode?"].appendChild(document.createTextNode( Date(y++, 0), {formatLength:"yearOnly", locale:that.lang})));

} f("previous"); f("current"); f("next");


_initUI:function (days) {

dojo.dom.removeChildren(this.calendarDatesContainerNode); for (var i = 0; i < this.displayWeeks; i++) {


} var nextDate = new Date(this.firstDay); this._setMonthLabel(this.curMonth.getMonth()); this._setYearLabels(this.curMonth.getFullYear()); var calendarNodes = this.calendarDatesContainerNode.getElementsByTagName("td"); var calendarRows = this.calendarDatesContainerNode.getElementsByTagName("tr"); var currentCalendarNode; for (i = 0; i < days; i++) {

currentCalendarNode = calendarNodes.item(i); dojo.dom.removeChildren(currentCalendarNode); currentCalendarNode.appendChild(document.createTextNode(nextDate.getDate())); currentCalendarNode.setAttribute("djDateValue", nextDate.valueOf()); var curClass = (nextDate.getMonth() != this.curMonth.getMonth() && Number(nextDate) < Number(this.curMonth)) ? "previous" : (nextDate.getMonth() == this.curMonth.getMonth()) ? "current" : "next"; var mappedClass = curClass; if (this._isDisabledDate(nextDate)) {

var classMap = {previous:"disabledPrevious", current:"disabledCurrent", next:"disabledNext"}; mappedClass = classMap[curClass];

} dojo.html.setClass(currentCalendarNode, this._getDateClassName(nextDate, mappedClass)); if (dojo.html.hasClass(currentCalendarNode, this.classNames.selectedDate)) {

this.selectedNode = currentCalendarNode;

} nextDate =,, 1);

} this.lastDay =,, -1); this._initControls();


References explaining this issue...

Change History (4)

comment:1 Changed 15 years ago by bill

Component: GeneralDijit
Milestone: 0.40.9
Owner: changed from anonymous to bill
Priority: highnormal
Summary: IE throws exception when using innerHTML property of element(s)Calendar: IE throws exception when using innerHTML property of element(s)

Wow, that's a weird one; the first link above is really informative. Not sure if this is still an issue on 0.9 but passing to Adam.

comment:2 Changed 15 years ago by Adam Peller

Owner: changed from bill to Adam Peller

comment:3 Changed 15 years ago by Adam Peller

Resolution: fixed
Status: newclosed

(In [9453]) Replace innerHTML setting with createTextNode calls. Fixes #3434.

comment:4 Changed 14 years ago by bill

(In [16192]) Just adding comment so no one erases _setText() method, refs #3434 !strict.

Note: See TracTickets for help on using tickets.