Skip to content

Commit

Permalink
prep version patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas Oppermann committed Jun 20, 2017
1 parent 3395438 commit 22ca9c8
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 16 deletions.
26 changes: 23 additions & 3 deletions dist/html.sortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,11 @@ var _getChildren = function (element) {
return element.children
}

var _serialize = function (list) {
var children = _filter(_getChildren(list), _data(list, 'items'))
return children
}

/*
* Public sortable object
* @param {Array|NodeList} sortableElements
Expand Down Expand Up @@ -505,12 +510,22 @@ var sortable = function (sortableElements, options) {

sortableElements = Array.prototype.slice.call(sortableElements)

if (/serialize/.test(method)) {
var serialized = []
sortableElements.forEach(function (sortableElement) {
serialized.push({
list: sortableElement,
children: _serialize(sortableElement)
})
})
return serialized
}

/* TODO: maxstatements should be 25, fix and remove line below */
/* jshint maxstatements:false */
sortableElements.forEach(function (sortableElement) {
if (/enable|disable|destroy/.test(method)) {
sortable[method](sortableElement)
return
return sortable[method](sortableElement)
}

// get options & set options on sortable
Expand All @@ -522,6 +537,7 @@ var sortable = function (sortableElements, options) {
var items = _filter(_getChildren(sortableElement), options.items)
var index
var startParent
var startList
var placeholder = options.placeholder
var maxItems
if (!placeholder) {
Expand Down Expand Up @@ -590,6 +606,7 @@ var sortable = function (sortableElements, options) {
index = _index(dragging)
draggingHeight = parseInt(window.getComputedStyle(dragging).height)
startParent = this.parentElement
startList = _serialize(startParent)
// dispatch sortstart event on each element in group
_dispatchEventOnConnected(sortableElement, _makeEvent('sortstart', {
item: dragging,
Expand Down Expand Up @@ -624,7 +641,10 @@ var sortable = function (sortableElements, options) {
elementIndex: _index(dragging),
oldElementIndex: index,
startparent: startParent,
endparent: newParent
endparent: newParent,
newEndList: _serialize(newParent),
newStartList: _serialize(startParent),
oldStartList: startList
}))
}
dragging = null
Expand Down
2 changes: 1 addition & 1 deletion dist/html.sortable.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/html.sortable.min.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 22ca9c8

Please sign in to comment.