function(el) {

        var $el = this.$(el);

        if ($el.length === 0 || $el[0] === this.el) {

            // If the overall cell has set `magnet === false`, then return `undefined` to
            // announce there is no magnet found for this cell.
            // This is especially useful to set on cells that have 'ports'. In this case,
            // only the ports have set `magnet === true` and the overall element has `magnet === false`.
            var attrs = this.model.get('attrs') || {};
            if (attrs['.'] && attrs['.']['magnet'] === false) {
                return undefined;
            }

            return this.el;
        }

        if ($el.attr('magnet')) {

            return $el[0];
        }

        return this.findMagnet($el.parent());
    }
function(el) {

        var $el = this.$(el);

        if ($el.length === 0 || $el[0] === this.el) {

            
            
            
            
            var attrs = this.model.get('attrs') || {};
            if (attrs['.'] && attrs['.']['magnet'] === false) {
                return undefined;
            }

            return this.el;
        }

        if ($el.attr('magnet')) {

            return $el[0];
        }

        return this.findMagnet($el.parent());
    }
function ( el ) { var $el = this . $ ( el ) ; if ( $el . length === 0 || $el [ 0 ] === this . el ) { // If the overall cell has set `magnet === false`, then return `undefined` to // announce there is no magnet found for this cell. // This is especially useful to set on cells that have 'ports'. In this case, // only the ports have set `magnet === true` and the overall element has `magnet === false`. var attrs = this . model . get ( 'attrs' ) || { } ; if ( attrs [ '.' ] && attrs [ '.' ] [ 'magnet' ] === false ) { return undefined ; } return this . el ; } if ( $el . attr ( 'magnet' ) ) { return $el [ 0 ] ; } return this . findMagnet ( $el . parent ( ) ) ; }
Find the closest element that has the `magnet` attribute set to `true`. If there was not such an element found, return the root element of the cell view.
Find the closest element that has the magnet attribute set to true . If there was not such an element found return the root element of the cell view .