dist/joint.nowrap.js
function(el) {

        var $el = this.$(el);
        var $rootEl = this.$el;

        if ($el.length === 0) {
            $el = $rootEl;
        }

        do {

            var magnet = $el.attr('magnet');
            if ((magnet || $el.is($rootEl)) && magnet !== 'false') {
                return $el[0];
            }

            $el = $el.parent();

        } while ($el.length > 0);

        // 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`.
        return undefined;
    }
function(el) {

        var $el = this.$(el);
        var $rootEl = this.$el;

        if ($el.length === 0) {
            $el = $rootEl;
        }

        do {

            var magnet = $el.attr('magnet');
            if ((magnet || $el.is($rootEl)) && magnet !== 'false') {
                return $el[0];
            }

            $el = $el.parent();

        } while ($el.length > 0);

        // 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`.
        return undefined;
    }
function ( el ) { var $el = this . $ ( el ) ; var $rootEl = this . $el ; if ( $el . length === 0 ) { $el = $rootEl ; } do { var magnet = $el . attr ( 'magnet' ) ; if ( ( magnet || $el . is ( $rootEl ) ) && magnet !== 'false' ) { return $el [ 0 ] ; } $el = $el . parent ( ) ; } while ( $el . length > 0 ) ; // 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`. return undefined ; }
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 .