Skip to content

multi select using shift selecting non children elements too #11

Description

@iamtennislover

Hi,
1st thing, this is a great library. but i found a small bug and a fix for it too.

Bug is: when using SHIFT key to select elements, library also selects non-childrens.

Example is here: http://jsfiddle.net/abarik/1nmx68fm/2/

capture

Fix for it starting line 428

    elem: function(d, el, s, u) {
        var $els = [], $el = (d) ? el.next() : el.prev();
        while( $el.length ) {
            if(typeof u === 'undefined' || !u || !$el.hasClass(u)) {
                if(typeof s === 'undefined' || !s || $el.hasClass(s)) {
                    // abarik-BUG FIX------START
                    // if children is provided
                    // push only if the element is a child
                    if (o.children) {
                        if ($el.is(o.children)) {
                            $els.push($el[0]);
                        }
                    } else {
                        $els.push($el[0]);
                    }
                    // abarik-BUG FIX------END

                }
                $el = (d) ? $el.next() : $el.prev();
            } else {
                $el = {};
            }
        }
        return $($els)
    },

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions