{infiniteZest}
// Articles. Tutorials. Utilities.
Home  |   Search  |   Login  
Categories Skip Navigation Links
New / All
AJAX
Apple
ASP.NET
.NET
Git
Google / Android
Python / IronPython
Miscellaneous
SQL Server
AJAX Source Viewer
View the source code of a Method from ASP.NET AJAX Library. Choose a method from the menu items above (Namespaces, Classes, or Methods).
Method 'getLocation(element)'
Method: getLocation(element)
Method Full Name:     Sys$UI$DomElement$getLocation(element)
Class: DomElement
Namespace: Sys.UI
Source File: MicrosoftAjax.debug.js
1   Sys.UI.DomElement.getLocation = function Sys$UI$DomElement$getLocation(element) {
2     /// <summary locid="M:J#Sys.UI.DomElement.getLocation" />
3     /// <param name="element" domElement="true"></param>
4     /// <returns type="Sys.UI.Point"></returns>
5     var e = Function._validateParams(arguments, [
6     {name: "element", domElement: true}
7     ]);
8     if (e) throw e;
9     if ((element.window && (element.window === element)) || element.nodeType === 9) return new Sys.UI.Point(0,0);
10    var offsetX = 0;
11    var offsetY = 0;
12    var previous = null;
13    for (var parent = element; parent; previous = parent, parent = parent.offsetParent) {
14      var tagName = parent.tagName;
15      offsetX += parent.offsetLeft || 0;
16      offsetY += parent.offsetTop || 0;
17    }
18    var elementPosition = element.style.position;
19    var elementPositioned = elementPosition && (elementPosition !== "static");
20    for (var parent = element.parentNode; parent; parent = parent.parentNode) {
21      tagName = parent.tagName;
22      if ((tagName !== "BODY") && (tagName !== "HTML") && (parent.scrollLeft || parent.scrollTop) &&
23      ((elementPositioned &&
24      ((parent.style.overflow === "scroll") || (parent.style.overflow === "auto"))))) {
25        offsetX -= (parent.scrollLeft || 0);
26        offsetY -= (parent.scrollTop || 0);
27      }
28      var parentPosition = (parent && parent.style) ? parent.style.position : null;
29      elementPositioned = elementPositioned || (parentPosition && (parentPosition !== "static"));
30    }
31    return new Sys.UI.Point(offsetX, offsetY);
32  }
This is the JavaScript source for method getLocation(element) from ASP.NET AJAX Library. Full name for this method is Sys$UI$DomElement$getLocation(element). It belongs to the class DomElement, which is in Sys.UI namespace. This source is in MicrosoftAjax.debug.js file.
Bookmark and Share This
About  Contact  Privacy Policy  Site Map