lib/json-format.js
function collapse(evt) {
        var collapser = evt.target;

        var target = collapser.parentNode.getElementsByClassName('collapsible');

        if ( ! target.length ) {
            return
        }

        target = target[0];

        if ( target.style.display === 'none' ) {
            var ellipsis = target.parentNode
                .getElementsByClassName('ellipsis')[0]
            target.parentNode.removeChild(ellipsis);
            target.style.display = '';
            collapser.innerHTML = '-';
        } else {
            target.style.display = 'none';

            var ellipsis = document.createElement('span');
            ellipsis.className = 'ellipsis';
            ellipsis.innerHTML = ' &hellip; ';
            target.parentNode.insertBefore(ellipsis, target);
            collapser.innerHTML = '+';
        }
    }
function collapse(evt) {
        var collapser = evt.target;

        var target = collapser.parentNode.getElementsByClassName('collapsible');

        if ( ! target.length ) {
            return
        }

        target = target[0];

        if ( target.style.display === 'none' ) {
            var ellipsis = target.parentNode
                .getElementsByClassName('ellipsis')[0]
            target.parentNode.removeChild(ellipsis);
            target.style.display = '';
            collapser.innerHTML = '-';
        } else {
            target.style.display = 'none';

            var ellipsis = document.createElement('span');
            ellipsis.className = 'ellipsis';
            ellipsis.innerHTML = ' &hellip; ';
            target.parentNode.insertBefore(ellipsis, target);
            collapser.innerHTML = '+';
        }
    }
TODO remember collapsal path