Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nested-sort

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nested-sort - npm Package Compare versions

Comparing version 2.3.1 to 3.0.0

29

dist/nested-sort.cjs.js

@@ -273,3 +273,3 @@ 'use strict';

const list = this.getDataEngine().render();
document.getElementById(this.selector).appendChild(list);
document.querySelector(this.selector).appendChild(list);
}

@@ -279,4 +279,10 @@

if (this.sortableList instanceof HTMLUListElement) return this.sortableList
const list = document.getElementById(this.selector);
this.sortableList = list.nodeName === 'UL' ? list : list.querySelector('ul');
if (this.selector instanceof HTMLUListElement) {
this.sortableList = this.selector;
} else {
const list = document.querySelector(this.selector);
this.sortableList = list.nodeName === 'UL' ? list : list.querySelector('ul');
}
return this.sortableList

@@ -299,2 +305,4 @@ }

el.addEventListener('dragenter', this.onDragEnter.bind(this), false);
el.addEventListener('dragover', this.onDragOver.bind(this), false);
el.addEventListener('dragleave', this.onDragLeave.bind(this), false);
el.addEventListener('dragend', this.onDragEnd.bind(this), false);

@@ -330,2 +338,4 @@ el.addEventListener('drop', this.onDrop.bind(this), false);

onDragEnter(e) {
if (!this.draggedNode) return
if (['LI', 'UL'].includes(e.target.nodeName)) {

@@ -337,5 +347,2 @@ e.preventDefault(); // prevent default to allow drop

e.target.classList.add(this.classNames.targeted);
e.target.addEventListener('dragover', this.onDragOver.bind(this), false);
e.target.addEventListener('dragleave', this.onDragLeave.bind(this), false);
}

@@ -353,5 +360,7 @@ }

e.preventDefault();
e.stopPropagation();
this.draggedNode.classList.remove(this.classNames.dragged);
this.targetedNode.classList.remove(this.classNames.targeted);
this.cleanupPlaceholderLists();
this.draggedNode = null;
}

@@ -432,9 +441,3 @@

areNested(child, parent) {
let isChild = false;
parent.querySelectorAll('li').forEach(li => {
if (li === child) {
isChild = true;
}
});
return isChild;
return parent && Array.from(parent.querySelectorAll('li')).some(li => li === child)
}

@@ -441,0 +444,0 @@

@@ -271,3 +271,3 @@ class DataEngine {

const list = this.getDataEngine().render();
document.getElementById(this.selector).appendChild(list);
document.querySelector(this.selector).appendChild(list);
}

@@ -277,4 +277,10 @@

if (this.sortableList instanceof HTMLUListElement) return this.sortableList
const list = document.getElementById(this.selector);
this.sortableList = list.nodeName === 'UL' ? list : list.querySelector('ul');
if (this.selector instanceof HTMLUListElement) {
this.sortableList = this.selector;
} else {
const list = document.querySelector(this.selector);
this.sortableList = list.nodeName === 'UL' ? list : list.querySelector('ul');
}
return this.sortableList

@@ -297,2 +303,4 @@ }

el.addEventListener('dragenter', this.onDragEnter.bind(this), false);
el.addEventListener('dragover', this.onDragOver.bind(this), false);
el.addEventListener('dragleave', this.onDragLeave.bind(this), false);
el.addEventListener('dragend', this.onDragEnd.bind(this), false);

@@ -328,2 +336,4 @@ el.addEventListener('drop', this.onDrop.bind(this), false);

onDragEnter(e) {
if (!this.draggedNode) return
if (['LI', 'UL'].includes(e.target.nodeName)) {

@@ -335,5 +345,2 @@ e.preventDefault(); // prevent default to allow drop

e.target.classList.add(this.classNames.targeted);
e.target.addEventListener('dragover', this.onDragOver.bind(this), false);
e.target.addEventListener('dragleave', this.onDragLeave.bind(this), false);
}

@@ -351,5 +358,7 @@ }

e.preventDefault();
e.stopPropagation();
this.draggedNode.classList.remove(this.classNames.dragged);
this.targetedNode.classList.remove(this.classNames.targeted);
this.cleanupPlaceholderLists();
this.draggedNode = null;
}

@@ -430,9 +439,3 @@

areNested(child, parent) {
let isChild = false;
parent.querySelectorAll('li').forEach(li => {
if (li === child) {
isChild = true;
}
});
return isChild;
return parent && Array.from(parent.querySelectorAll('li')).some(li => li === child)
}

@@ -439,0 +442,0 @@

@@ -392,3 +392,3 @@ (function (global, factory) {

var list = this.getDataEngine().render();
document.getElementById(this.selector).appendChild(list);
document.querySelector(this.selector).appendChild(list);
}

@@ -399,4 +399,10 @@ }, {

if (this.sortableList instanceof HTMLUListElement) return this.sortableList;
var list = document.getElementById(this.selector);
this.sortableList = list.nodeName === 'UL' ? list : list.querySelector('ul');
if (this.selector instanceof HTMLUListElement) {
this.sortableList = this.selector;
} else {
var list = document.querySelector(this.selector);
this.sortableList = list.nodeName === 'UL' ? list : list.querySelector('ul');
}
return this.sortableList;

@@ -422,2 +428,4 @@ }

el.addEventListener('dragenter', _this.onDragEnter.bind(_this), false);
el.addEventListener('dragover', _this.onDragOver.bind(_this), false);
el.addEventListener('dragleave', _this.onDragLeave.bind(_this), false);
el.addEventListener('dragend', _this.onDragEnd.bind(_this), false);

@@ -459,2 +467,4 @@ el.addEventListener('drop', _this.onDrop.bind(_this), false);

value: function onDragEnter(e) {
if (!this.draggedNode) return;
if (['LI', 'UL'].includes(e.target.nodeName)) {

@@ -466,4 +476,2 @@ e.preventDefault(); // prevent default to allow drop

e.target.classList.add(this.classNames.targeted);
e.target.addEventListener('dragover', this.onDragOver.bind(this), false);
e.target.addEventListener('dragleave', this.onDragLeave.bind(this), false);
}

@@ -483,5 +491,7 @@ }

e.preventDefault();
e.stopPropagation();
this.draggedNode.classList.remove(this.classNames.dragged);
this.targetedNode.classList.remove(this.classNames.targeted);
this.cleanupPlaceholderLists();
this.draggedNode = null;
}

@@ -572,9 +582,5 @@ }, {

value: function areNested(child, parent) {
var isChild = false;
parent.querySelectorAll('li').forEach(function (li) {
if (li === child) {
isChild = true;
}
return parent && Array.from(parent.querySelectorAll('li')).some(function (li) {
return li === child;
});
return isChild;
}

@@ -581,0 +587,0 @@ }, {

{
"name": "nested-sort",
"version": "2.3.1",
"version": "3.0.0",
"author": "Hesam Bahrami (Genzo)",

@@ -5,0 +5,0 @@ "description": "A JavaScript library to create a nested list of elements",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc