The browser doesn't provide sizes of elements that are not visible.
This will clone an element and add it to the DOM for calculations.

@param {jQuery} $el
@param {Function} callback
762290
function sizingInvisible($el, callback) {
        var targets;

        // We wish to target ourselves and any parents as long as
        // they are not visible
        targets = $el.parents();
        targets.push($el[0]);
        targets = targets.not(':visible');
        swap(targets, {
            visibility: "hidden",
            display: "block",
            position: "absolute"
        }, callback);
    }
1283062
function _setClass(el, className) {
    el instanceof SVGElement ?
        el.setAttribute('class', className) :
        el.className = className;
}
52558
function (el, ev, callback, selector) {
		return selector ?
			delegate(el, selector.trim(), ev, callback) :
			bind(el, ev, callback);
	}
1256242
function reveal(el) {
      if (el.hasChildNodes()) {
        // dealing with a container try and find children
        var els = el.querySelectorAll('[data-src], [data-bkg]');
        var elsl = els.length;
        if (elsl === 0) {
          // node has children, but none have the attributes, so reveal
          // the node itself (use case: div with a background)
          doReveal(el);
        } else {
          for (var j = 0; j < elsl; j++) {
            doReveal(els[j]);
          }
        }
      } else {
        doReveal(el);
      }
    }
984105
function fadeIn(el)
{
	el.style.opacity = 0;
	el.style.display = "block";

	(function fadeIn() {
		let val = parseFloat(el.style.opacity);
		if (! ((val += .1) > 1)) {
			el.style.opacity = val;
			setTimeout(fadeIn, 40);
		}
	})();
}
615321
function(el, eventName, data)
    {
        var ev;

        if (document.createEvent) {
            ev = document.createEvent('HTMLEvents');
            ev.initEvent(eventName, true, false);
            ev = extend(ev, data);
            el.dispatchEvent(ev);
        } else if (document.createEventObject) {
            ev = document.createEventObject();
            ev = extend(ev, data);
            el.fireEvent('on' + eventName, ev);
        }
    }
1324668
function(el, url) {
      if (url) {
        var rect = GetElementViewportRect(el);
        if (rect) {
          rects.push({'url': url,
                       'area': rect.area,
                       'rect': rect});
        }
      }
    }
527607
function scroll(el) {
    if (!el) {
        return;
    }

    const parentEl = el && el.parentElement;
    const offsetBottom = el.offsetTop + el.offsetHeight;
    const scrollBottom = parentEl.scrollTop + parentEl.offsetHeight;

    if (el.offsetTop < parentEl.scrollTop) {
        parentEl.scrollTop = el.offsetTop;
    } else if (offsetBottom > scrollBottom) {
        parentEl.scrollTop = offsetBottom - parentEl.offsetHeight;
    }
}
1006846
function (el) {

    return /** @lends dom **/ {

        /**
         * Adds class to element.
         * @param {string} className
         */
        addClass: function (className) {
            if (el.classList) {
                el.classList.add(className);
            } else {
                el.className += ' ' + className;
            }
        },

        /**
         * Removes class from element.
         * @param {string} className
         */
        removeClass: function (className) {
            if (el.classList) {
                el.classList.remove(className);
            } else {
                el.className = el.className.replace(
                    new RegExp('(^|\\b)' + className + '(\\b|$)', 'gi'), ' '
                );
            }
        },

        /**
         * Prepends child nodes to base element.
         * @param {Node[]} nodesToPrepend
         */
        prepend: function (nodesToPrepend) {
            let nodes = Array.prototype.slice.call(nodesToPrepend),
                i = nodes.length;

            while (i--) {
                el.insertBefore(nodes[i], el.firstChild);
            }
        },

        /**
         * Appends child nodes to base element.
         * @param {Node[]} nodesToAppend
         */
        append: function (nodesToAppend) {
            let nodes = Array.prototype.slice.call(nodesToAppend);

            for (let i = 0, len = nodes.length; i < len; ++i) {
                el.appendChild(nodes[i]);
            }
        },

        /**
         * Inserts base element after refEl.
         * @param {Node} refEl - node after which base element will be inserted
         * @returns {Node} - inserted element
         */
        insertAfter: function (refEl) {
            return refEl.parentNode.insertBefore(el, refEl.nextSibling);
        },

        /**
         * Inserts base element before refEl.
         * @param {Node} refEl - node before which base element will be inserted
         * @returns {Node} - inserted element
         */
        insertBefore: function (refEl) {
            return refEl.parentNode.insertBefore(el, refEl);
        },

        /**
         * Removes base element from DOM.
         */
        remove: function () {
            el.parentNode.removeChild(el);
            el = null;
        },

        /**
         * Returns true if base element contains given child.
         * @param {Node|HTMLElement} child
         * @returns {boolean}
         */
        contains: function (child) {
            return el !== child && el.contains(child);
        },

        /**
         * Wraps base element in wrapper element.
         * @param {HTMLElement} wrapper
         * @returns {HTMLElement} wrapper element
         */
        wrap: function (wrapper) {
            if (el.parentNode) {
                el.parentNode.insertBefore(wrapper, el);
            }

            wrapper.appendChild(el);
            return wrapper;
        },

        /**
         * Unwraps base element.
         * @returns {Node[]} - child nodes of unwrapped element.
         */
        unwrap: function () {
            let nodes = Array.prototype.slice.call(el.childNodes),
                wrapper;

            nodes.forEach(function (node) {
                wrapper = node.parentNode;
                dom(node).insertBefore(node.parentNode);
                dom(wrapper).remove();
            });

            return nodes;
        },

        /**
         * Returns array of base element parents.
         * @returns {HTMLElement[]}
         */
        parents: function () {
            let parent, path = [];

            while (!!(parent = el.parentNode)) {
                path.push(parent);
                el = parent;
            }

            return path;
        },

        /**
         * Normalizes text nodes within base element, ie. merges sibling text nodes and assures that every
         * element node has only one text node.
         * It should does the same as standard element.normalize, but IE implements it incorrectly.
         */
        normalizeTextNodes: function () {
            if (!el) {
                return;
            }

            if (el.nodeType === NODE_TYPE.TEXT_NODE) {
                while (el.nextSibling && el.nextSibling.nodeType === NODE_TYPE.TEXT_NODE) {
                    el.nodeValue += el.nextSibling.nodeValue;
                    el.parentNode.removeChild(el.nextSibling);
                }
            } else {
                dom(el.firstChild).normalizeTextNodes();
            }
            dom(el.nextSibling).normalizeTextNodes();
        },

        /**
         * Returns element background color.
         * @returns {CSSStyleDeclaration.backgroundColor}
         */
        color: function () {
            return el.style.backgroundColor;
        },

        /**
         * Creates dom element from given html string.
         * @param {string} html
         * @returns {NodeList}
         */
        fromHTML: function (html) {
            let div = document.createElement('div');
            div.innerHTML = html;
            return div.childNodes;
        },

        /**
         * Returns first range of the window of base element.
         * @returns {Range}
         */
        getRange: function () {
            let selection = dom(el).getSelection(),
                range;

            if (selection.rangeCount > 0) {
                range = selection.getRangeAt(0);
            }

            return range;
        },

        /**
         * Removes all ranges of the window of base element.
         */
        removeAllRanges: function () {
            let selection = dom(el).getSelection();
            selection.removeAllRanges();
        },

        /**
         * Returns selection object of the window of base element.
         * @returns {Selection}
         */
        getSelection: function () {
            return dom(el).getWindow().getSelection();
        },

        /**
         * Returns window of the base element.
         * @returns {Window}
         */
        getWindow: function () {
            return dom(el).getDocument().defaultView;
        },

        /**
         * Returns document of the base element.
         * @returns {HTMLDocument}
         */
        getDocument: function () {
            // if ownerDocument is null then el is the document itself.
            return el.ownerDocument || el;
        }

    };
}
899653
function($el) {

        var el = joint.util.isString($el)
            ? this.viewport.querySelector($el)
            : $el instanceof $ ? $el[0] : $el;

        var id = this.findAttribute('model-id', el);
        if (id) return this._views[id];

        return undefined;
    }
423482
public function addSortable($element, Closure $callback = null)
    {
        $this->scaffoldSortable();

        if (null === $callback) {
            $this->sortable[] = $element;
        } else {
            $this->sortable[$element] = $callback;
        }

        return $this;
    }
480282
function(el, e, callback, capture)
    {
        if (hasEventListeners) {
            el.addEventListener(e, callback, !!capture);
        } else {
            el.attachEvent('on' + e, callback);
        }
    }
1373937
function(el) {
	// manually create a copy of the element
	var new_el = document.createElementNS(el.namespaceURI, el.nodeName);
	$.each(el.attributes, function(i, attr) {
		if (attr.localName != '-moz-math-font-style') {
			new_el.setAttributeNS(attr.namespaceURI, attr.nodeName, attr.nodeValue);
		}
	});
	// set the copied element's new id
	new_el.removeAttribute("id");
	new_el.id = getNextId();
	
	// Opera's "d" value needs to be reset for Opera/Win/non-EN
	// Also needed for webkit (else does not keep curved segments on clone)
	if (svgedit.browser.isWebkit() && el.nodeName == 'path') {
		var fixed_d = pathActions.convertPath(el);
		new_el.setAttribute('d', fixed_d);
	}

	// now create copies of all children
	$.each(el.childNodes, function(i, child) {
		switch(child.nodeType) {
			case 1: // element node
				new_el.appendChild(copyElem(child));
				break;
			case 3: // text node
				new_el.textContent = child.nodeValue;
				break;
			default:
				break;
		}
	});
	
	if ($(el).data('gsvg')) {
		$(new_el).data('gsvg', new_el.firstChild);
	} else if ($(el).data('symbol')) {
		var ref = $(el).data('symbol');
		$(new_el).data('ref', ref).data('symbol', ref);
	} else if (new_el.tagName == 'image') {
		preventClickDefault(new_el);
	}
	return new_el;
}
11906
function addEvent(el, e, callback, capture) {
    if (el.addEventListener) {
      el.addEventListener(e, callback, capture || false);
    }
    else
      if (el.attachEvent) {
        el.attachEvent('on' + e, callback);
      }
  }
153331
function merge( elem, callback ) {
		var old = find( destChildren, elem.name ),
			nl;

		// merge with old element
		if ( old ) {
			if ( typeof callback == 'function' ) {
				return callback( old );
			}

			_.merge( old.attribs, elem.attribs );

			if ( elem.children ) {
				combine( old, elem );
			}
			// append new element
		} else {
			if ( dest.children ) {
				utils.appendChild( dest, elem );
			} else {
				utils.prepend( destChildren[ 0 ], elem );
				// fix for domutils issue
				elem.parent = destChildren[ 0 ].parent;
				destChildren.unshift( elem );
				destChildren.splice( destChildren.indexOf( elem ) + 1, 0, nl );
			}
		}
	}
1106821
function( el ) {
			var j = Syn.jquery()(el),
				o = j.offset();
			return {
				pageX: o.left + (j.width() / 2),
				pageY: o.top + (j.height() / 2)
			}
		}
41878
function(el) {
            if (typeof el.remove === 'function')
                el.remove();
            else if (el.parentElement)
                el.parentElement.removeChild(el);
        }