Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix]: When destroying, failed to remove the dragover and dragenter events. #2373

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
version: 2.0
version: 2.1
orbs:
browser-tools: circleci/[email protected]
jobs:
build:
docker:
- image: circleci/node:10.16-browsers
- image: cimg/node:16.20.2-browsers
steps:
- browser-tools/install-browser-tools
- checkout

- run: |
node --version
java --version
google-chrome --version
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-node-resolve": "^5.0.0",
"testcafe": "^1.3.1",
"testcafe-browser-provider-saucelabs": "^1.7.0",
"testcafe-reporter-xunit": "^2.1.0",
"testcafe": "^3.6.0",
"testcafe-browser-provider-saucelabs": "^3.0.0",
"testcafe-reporter-xunit": "^2.2.3",
"uglify-js": "^3.5.12"
},
"description": "JavaScript library for reorderable drag-and-drop lists on modern browsers and touch devices. No jQuery required. Supports Meteor, AngularJS, React, Polymer, Vue, Knockout and any CSS library, e.g. Bootstrap.",
Expand Down
10 changes: 5 additions & 5 deletions src/Sortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,10 +429,10 @@ function Sortable(el, options) {
on(el, 'mousedown', this._onTapStart);
on(el, 'touchstart', this._onTapStart);
}

this._handleEvent = this.handleEvent.bind(this)
if (this.nativeDraggable) {
on(el, 'dragover', this);
on(el, 'dragenter', this);
on(el, 'dragover', this._handleEvent);
on(el, 'dragenter', this._handleEvent);
}

sortables.push(this.el);
Expand Down Expand Up @@ -1678,8 +1678,8 @@ Sortable.prototype = /** @lends Sortable.prototype */ {
off(el, 'pointerdown', this._onTapStart);

if (this.nativeDraggable) {
off(el, 'dragover', this);
off(el, 'dragenter', this);
off(el, 'dragover', this._handleEvent);
off(el, 'dragenter', this._handleEvent);
}
// Remove draggable attributes
Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
Expand Down