It appears that IE has issues (what else is new?) traversing the DOM when dynamically-inserted elements are involved. Specifically, these are the steps which are taken in the example below:
- New month view is loaded and inserted via Ajax.Updater
- Loaded in the preceeding Ajax call is a JSON object containing event data
- Using the script.ac Builder object, the calendar events are built and inserted, based on the data in the JSON object
- When an event is dragged, IE throws an error when Position.cumulativeOffset (as used by script.ac Draggables) attempts to move up the DOM tree starting from the element being dragged.
Replicating the issue:
Go to http://pamplona.isaka.net/calendar/calendar/index/2006/07/0/buggy in IE6
Click "< Prev" to page to the previous month (June), then try to drag an event
You can observe the patched version at http://pamplona.isaka.net/calendar/
The diff is against the full Prototype file, rather than the individual component in question, I hope that's okay.
Patch:
@@ -1805,9 +1805,11 @@
cumulativeOffset: function(element) {
var valueT = 0, valueL = 0;
do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- element = element.offsetParent;
+ valueT += element.offsetTop || 0;
+ valueL += element.offsetLeft || 0;
+ if (typeof element.offsetParent == 'undefined' || typeof element.offsetParent == 'unknown')
+ break;
+ element = element.offsetParent;
} while (element);
return [valueL, valueT];
},