From f74d5a8f37c6de4815000d47af7183aa51b9f9b4 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Mon, 5 Apr 2010 13:47:05 -0600 Subject: [PATCH] Fix javascript error on IE (see prototype bug 38) --- horde/js/ContextSensitive.js | 2 +- horde/js/dragdrop2.js | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/horde/js/ContextSensitive.js b/horde/js/ContextSensitive.js index adfe3c62b..2a5c369b8 100644 --- a/horde/js/ContextSensitive.js +++ b/horde/js/ContextSensitive.js @@ -217,7 +217,7 @@ var ContextSensitive = Class.create({ { if (this.trigger(e.element(), left, e.pointerX(), e.pointerY())) { e.stop(); - }; + } }, /** diff --git a/horde/js/dragdrop2.js b/horde/js/dragdrop2.js index 7653ff365..f6cddd79a 100644 --- a/horde/js/dragdrop2.js +++ b/horde/js/dragdrop2.js @@ -273,7 +273,7 @@ Drag = Class.create({ this.lastcaption = null; this.clickEvent = e; - this.element.fire('DragDrop2:mousedown', e); + this.element.fire('DragDrop2:mousedown', Object.clone(e)); if (this.options.ghosting || this.options.caption) { if (!DragDrop.Drags.cover) { @@ -314,7 +314,7 @@ Drag = Class.create({ if (++this.move <= this.options.threshold) { return; } else if (!this.wasMoved) { - this.element.fire('DragDrop2:start', this.clickEvent); + this.element.fire('DragDrop2:start', Object.clone(this.clickEvent)); this.wasMoved = true; } @@ -413,7 +413,7 @@ Drag = Class.create({ this.wasDragged = true; - this.element.fire('DragDrop2:drag', e); + this.element.fire('DragDrop2:drag', Object.clone(e)); if (this.options.scroll) { this._onMoveScroll(); @@ -422,7 +422,7 @@ Drag = Class.create({ _mouseUp: function(e) { - var d = DragDrop.Drops.drop; + var d = DragDrop.Drops.drop, tmp; this._stopScrolling(); @@ -449,7 +449,15 @@ Drag = Class.create({ DragDrop.Drags.cover.down().siblings().invoke('remove'); } - this.element.fire(this.wasMoved ? 'DragDrop2:end' : 'DragDrop2:mouseup', e); + if (!this.element.parentNode) { + tmp = new Element('DIV').insert(this.element); + } + + this.element.fire(this.wasMoved ? 'DragDrop2:end' : 'DragDrop2:mouseup', Object.clone(e)); + + if (tmp) { + tmp.remove(); + } }, _onMoveDrag: function(xy, e) -- 2.11.0