Returns the absolute position of an element for certain browsers.
@param {HTMLElement} element The element to get a position
for.
@returns {Object} An object containing x and y as the
absolute position of the given element.
@memberOf module:Misc
558729
function(element) {
    var r = { x: element.offsetLeft, y: element.offsetTop };
    if (element.offsetParent) {
      var tmp = getAbsolutePosition(element.offsetParent);
      r.x += tmp.x;
      r.y += tmp.y;
    }
    return r;
  }
894276
function( pixel ) {
        var viewerCoordinates = this.imageToViewerElementCoordinates( pixel );
        return viewerCoordinates.plus(
                OpenSeadragon.getElementPosition( this.viewer.element ));
    }
523929
function (element) {
            var pos = {
                start : 0,
                end : 0
            };

            if ("selectionStart" in element) {
                // w3c standard, available in all but IE<9
                pos.start = element.selectionStart;
                pos.end = element.selectionEnd;
            } else {
                // old IE support
                var document = Aria.$window.document;
                if (document.selection) {
                    var sel = document.selection.createRange();
                    var initialLength = sel.text.length;
                    sel.moveStart('character', -element.value.length);
                    var x = sel.text.length;
                    pos.start = x - initialLength;
                    pos.end = x;
                }
            }

            return pos;
        }
467949
function getRectangle(el){
                        var box = el.getBoundingClientRect(),
                            top = Math.round(box.top + window.pageYOffset),
                            left = Math.round(box.left + window.pageXOffset),
                            height = typeof el.offsetHeight === 'undefined' ? 0 : el.offsetHeight,
                            width = typeof el.offsetWidth === 'undefined' ? 0 : el.offsetWidth;

                        return { top: top, left: left, height: height, width: width, meanY: top + height / 2}
                    }
650112
def locationFromElement(self, element):
        
        elementLocation = None
        for locationElement in element.findall('.location'):
            elementLocation = self.readLocationElement(locationElement)
            break
        return elementLocation
440465
function()
    {
        if( window.getSelection )
        {
            var sel = window.getSelection();
            if( ! sel.rangeCount )
                return false;
            var range = sel.getRangeAt(0).cloneRange();
            if( range.getBoundingClientRect ) // Missing for Firefox 3.5+3.6
            {
                var rect = range.getBoundingClientRect();
                // Safari 5.1 returns null, IE9 returns 0/0/0/0 if image selected
                if( rect && rect.left && rect.top && rect.right && rect.bottom )
                    return {
                        // Modern browsers return floating-point numbers
                        left: parseInt(rect.left),
                        top: parseInt(rect.top),
                        width: parseInt(rect.right - rect.left),
                        height: parseInt(rect.bottom - rect.top)
                    };
                // on Webkit 'range.getBoundingClientRect()' sometimes return 0/0/0/0 - but 'range.getClientRects()' works
                var rects = range.getClientRects ? range.getClientRects() : [];
                for( var i=0; i < rects.length; ++i )
                {
                    var rect = rects[i];
                    if( rect.left && rect.top && rect.right && rect.bottom )
                        return {
                            // Modern browsers return floating-point numbers
                            left: parseInt(rect.left),
                            top: parseInt(rect.top),
                            width: parseInt(rect.right - rect.left),
                            height: parseInt(rect.bottom - rect.top)
                        };
                }
            }
            /*
            // Fall back to inserting a temporary element (only for Firefox 3.5 and 3.6)
            var span = document.createElement('span');
            if( span.getBoundingClientRect )
            {
                // Ensure span has dimensions and position by
                // adding a zero-width space character
                span.appendChild( document.createTextNode('\u200b') );
                range.insertNode( span );
                var rect = span.getBoundingClientRect();
                var spanParent = span.parentNode;
                spanParent.removeChild( span );
                // Glue any broken text nodes back together
                spanParent.normalize();
                return {
                    left: parseInt(rect.left),
                    top: parseInt(rect.top),
                    width: parseInt(rect.right - rect.left),
                    height: parseInt(rect.bottom - rect.top)
                };
            }
            */
        }
        else if( document.selection )
        {
            var sel = document.selection;
            if( sel.type != 'Control' )
            {
                var range = sel.createRange();
                // IE8 return 0/0/0/0 if caret right before newline
                if( range.boundingLeft || range.boundingTop || range.boundingWidth || range.boundingHeight )
                    return {
                        left: range.boundingLeft,
                        top: range.boundingTop,
                        width: range.boundingWidth,
                        height: range.boundingHeight
                    };
            }
        }
        return false;
    }
877494
function( elem ) {
		if ( !elem || typeof elem === "string" ) {
			return jQuery.inArray( this[0],
				// If it receives a string, the selector is used
				// If it receives nothing, the siblings are used
				elem ? jQuery( elem ) : this.parent().children() );
		}
		// Locate the position of the desired element
		return jQuery.inArray(
			// If it receives a jQuery object, the first element is used
			elem.jquery ? elem[0] : elem, this );
	}
435663
function getNearestTypeElement(element) {
		var found = false;
		var moduleBoundaryReached = false;

		// We need to check for the existence of 'element' since occasionally we call this on a detached element node.
		// For example:
		//  1. event handlers like mouseout may sometimes detach nodes from the DOM
		//  2. event handlers like mouseleave will still fire on the detached node
		// Checking existence of element.parentNode ensures the element is a valid HTML Element
		while (!found && element && element.parentNode && !moduleBoundaryReached) {
			found = isTypeElement(element);
			moduleBoundaryReached = isModuleElement(element);

			if (!found) {
				element = element.parentNode;
			}

		}

		return found ? element : null;
	}
1128632
function (el) {
		var offsets = el.getPosition(); // #1496
		return {
			left: offsets.x,
			top: offsets.y
		};
	}
1299014
public static HTMLElement element(com.google.gwt.dom.client.Element element) {
        return Js.cast(element);
    }
881292
function getContainer(element, prop) {

	var cache;
	if (containerCache.has(element)) {
		cache = containerCache.get(element);
		if (cache[prop]) {
			return cache[prop];
		}
	}
	else {
		cache = {};
		containerCache.set(element, cache);
	}

	if (element === documentElement) {
		cache[prop] = element;
	}

	else if (prop !== 'width' && prop !== 'height') {
		// Skip transparent background colors
		if (prop === 'background-color' && !parseColor(getComputedStyle(element).getPropertyValue(prop))[3]) {
			cache[prop] = getContainer(element.parentNode, prop);
		}
		else {
			cache[prop] = element;
		}
	}

	// Skip inline elements
	else if (getComputedStyle(element).display === 'inline') {
		cache[prop] = getContainer(element.parentNode, prop);
	}

	else if (isFixedSize(element, prop)) {
		cache[prop] = element;
	}

	else {

		var parentNode = element.parentNode;

		// Skip to next positioned ancestor for absolute positioned elements
		if (getComputedStyle(element).position === 'absolute') {
			while (
				parentNode.parentNode
				&& parentNode.parentNode.nodeType === 1
				&& ['relative', 'absolute'].indexOf(getComputedStyle(parentNode).position) === -1
			) {
				parentNode = parentNode.parentNode;
			}
		}

		// Skip to next ancestor with a transform applied for fixed positioned elements
		if (getComputedStyle(element).position === 'fixed') {
			while (
				parentNode.parentNode
				&& parentNode.parentNode.nodeType === 1
				&& [undefined, 'none'].indexOf(
					getComputedStyle(parentNode).transform
					|| getComputedStyle(parentNode).MsTransform
					|| getComputedStyle(parentNode).WebkitTransform
				) !== -1
			) {
				parentNode = parentNode.parentNode;
			}
		}

		var parentContainer = getContainer(parentNode, prop);
		while (getComputedStyle(parentNode).display === 'inline') {
			parentNode = parentNode.parentNode;
		}
		if (parentNode === parentContainer && !isIntrinsicSize(element, prop)) {
			cache[prop] = element;
		}
		else {
			cache[prop] = parentContainer;
		}
	}

	return cache[prop];

}
949130
function getPosition(el) {
	var p = { left: el.offsetLeft, top: el.offsetTop };
	el = el.offsetParent;
	while (el) {
		p.left += el.offsetLeft;
		p.top += el.offsetTop;
		if (el !== doc.body && el !== doc.documentElement) {
			p.left -= el.scrollLeft;
			p.top -= el.scrollTop;
		}
		el = el.offsetParent;
	}
	return p;
}
548034
function(element) {
    element = $(element);
    var node = element.firstChild;
    while (node) {
      var nextNode = node.nextSibling;
      if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
        element.removeChild(node);
      node = nextNode;
    }
    return element;
  }
871338
function getElementPos(pos) {
    var l = 0
    for (var i = 0; i < pos - 1; i++) { l += elements[i] }
    return l
  }
1025047
function offset(element) {
	const elemBCR = element.getBoundingClientRect();
	return {
		width: Math.round(isNumber(elemBCR.width) ? elemBCR.width : element.offsetWidth),
		height: Math.round(isNumber(elemBCR.height) ? elemBCR.height : element.offsetHeight),
		top: Math.round(elemBCR.top + (window.pageYOffset || document.documentElement.scrollTop)),
		left: Math.round(elemBCR.left + (window.pageXOffset || document.documentElement.scrollLeft))
	};
}
1090200
function (element) {
    var left = 0
      , top = 0;

    do {
      left += element.offsetLeft;
      top += element.offsetTop;
    } while (element = element.offsetParent);

    return {
      left: left,
      top: top
    };
  }
57409
function (element, overlay) {
            var dom = ariaUtilsDom;
            var overlayStyle = overlay.style;
            var positions = ["Top", "Right", "Bottom", "Left"], singleBorder, border = {};
            for (var i = 0, posCount = positions.length; i < posCount; i++) {
                singleBorder = + dom.getStyle(overlay, "border" + positions[i] + "Width").split("px")[0];
                border[positions[i].toLowerCase()] = isNaN(singleBorder) ? 0 : singleBorder;
            }
            var geometry = ariaUtilsDom.getGeometry(element);
            if (geometry) {
                overlayStyle.position = "absolute";
                var scroll = dom.getDocumentScrollElement();
                overlayStyle.top = geometry.y + scroll.scrollTop + "px";
                overlayStyle.left = geometry.x + scroll.scrollLeft + "px";
                overlayStyle.width = (geometry.width - border.left - border.right) + "px";
                overlayStyle.height = (geometry.height - border.top - border.bottom) + "px";
                overlayStyle.display = "block";
            }
        }