var previousElementSibling = function (el) {

    do { el = el.previousSibling; } while (el && el.nodeType !== 1);
    return el;