|
27 | 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 | 28 | * ========================================================== */ |
29 | 29 |
|
30 | | -!function ( $, window, undefined){ |
| 30 | +!function ( $, window, pluginName, undefined){ |
31 | 31 | var eventNames, |
32 | | - pluginName = 'sortable', |
33 | 32 | containerDefaults = { |
34 | 33 | // If true, items can be dragged from this container |
35 | 34 | drag: true, |
|
101 | 100 | // Called on mousedown. If falsy value is returned, the dragging will not start. |
102 | 101 | // If clicked on input element, ignore |
103 | 102 | onMousedown: function ($item, _super, event) { |
104 | | - if (event.target.nodeName != 'INPUT' && event.target.nodeName != 'SELECT') { |
| 103 | + if (!event.target.nodeName.match(/^(input|select)$/i)) { |
105 | 104 | event.preventDefault() |
106 | 105 | return true |
107 | 106 | } |
|
115 | 114 | pullPlaceholder: true, |
116 | 115 | // Specifies serialization of the container group. |
117 | 116 | // The pair $parent/$children is either container/items or item/subcontainers. |
118 | | - // Note that this default method only works, if every item only has one subcontainer |
119 | 117 | serialize: function ($parent, $children, parentIsContainer) { |
120 | 118 | var result = $.extend({}, $parent.data()) |
121 | 119 |
|
122 | 120 | if(parentIsContainer) |
123 | | - return $children |
| 121 | + return [$children] |
124 | 122 | else if ($children[0]){ |
125 | 123 | result.children = $children |
126 | 124 | delete result.subContainer |
|
407 | 405 | }, |
408 | 406 | scroll: function (e) { |
409 | 407 | this.clearDimensions() |
410 | | - this.clearOffsetParent() |
| 408 | + this.clearOffsetParent() // TODO is this needed? |
411 | 409 | }, |
412 | 410 | toggleListeners: function (method, events) { |
413 | 411 | var that = this |
|
644 | 642 | }); |
645 | 643 | }; |
646 | 644 |
|
647 | | -}(jQuery, window); |
| 645 | +}(jQuery, window, 'sortable'); |
0 commit comments