Skip to content

Commit

Permalink
support ie9
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi6jp committed Jan 29, 2015
1 parent c8ffbda commit 2981a3b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 39 deletions.
73 changes: 35 additions & 38 deletions Sortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,46 +228,46 @@
}

// Prepare `dragstart`
if (target && !dragEl && (target.parentNode === el)) {
if (target && (target.parentNode === el)) {
// IE 9 Support
(type === 'selectstart') && target.dragDrop();

tapEvt = evt;

rootEl = this.el;
dragEl = target;
nextEl = dragEl.nextSibling;
activeGroup = this.options.group;

dragEl.draggable = true;
if (type === 'selectstart') {
target.dragDrop();
} else if (!dragEl) {
tapEvt = evt;

rootEl = this.el;
dragEl = target;
nextEl = dragEl.nextSibling;
activeGroup = this.options.group;

dragEl.draggable = true;

// Disable "draggable"
options.ignore.split(',').forEach(function (criteria) {
_find(target, criteria.trim(), _disableDraggable);
});

if (touch) {
// Touch device support
tapEvt = {
target: target,
clientX: touch.clientX,
clientY: touch.clientY
};

this._onDragStart(tapEvt, true);
evt.preventDefault();
}

// Disable "draggable"
options.ignore.split(',').forEach(function (criteria) {
_find(target, criteria.trim(), _disableDraggable);
});
_on(document, 'mouseup', this._onDrop);
_on(document, 'touchend', this._onDrop);
_on(document, 'touchcancel', this._onDrop);

if (touch) {
// Touch device support
tapEvt = {
target: target,
clientX: touch.clientX,
clientY: touch.clientY
};
_on(dragEl, 'dragend', this);
_on(rootEl, 'dragstart', this._onDragStart);

this._onDragStart(tapEvt, true);
evt.preventDefault();
_on(document, 'dragover', this);
}

_on(document, 'mouseup', this._onDrop);
_on(document, 'touchend', this._onDrop);
_on(document, 'touchcancel', this._onDrop);

_on(dragEl, 'dragend', this);
_on(rootEl, 'dragstart', this._onDragStart);

_on(document, 'dragover', this);


try {
if (document.selection) {
document.selection.empty();
Expand Down Expand Up @@ -496,7 +496,6 @@
return;
}


if ((el.children.length === 0) || (el.children[0] === ghostEl) ||
(el === evt.target) && (target = _ghostInBottom(el, evt))
) {
Expand All @@ -508,7 +507,6 @@
}

_cloneHide(isOwner);

el.appendChild(dragEl);
this._animate(dragRect, dragEl);
target && this._animate(targetRect, target);
Expand All @@ -535,7 +533,6 @@
setTimeout(_unsilent, 30);

_cloneHide(isOwner);

if (floating) {
after = (target.previousElementSibling === dragEl) && !isWide || halfway && isWide;
} else {
Expand Down
Loading

0 comments on commit 2981a3b

Please sign in to comment.