| Index: sdk/lib/html/dartium/html_dartium.dart
|
| diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
|
| index f817506bd27c1a42ca959f8c97d8cc07ecb9531c..461865bcd2c6ced0ee8ec6be58939c28917b1d5d 100644
|
| --- a/sdk/lib/html/dartium/html_dartium.dart
|
| +++ b/sdk/lib/html/dartium/html_dartium.dart
|
| @@ -9161,6 +9161,43 @@ abstract class Element extends Node implements ElementTraversal {
|
| */
|
| @Experimental()
|
| CssRect get marginEdge => new _MarginCssRect(this);
|
| +
|
| + /**
|
| + * Provides the coordinates of the element relative to the top of the
|
| + * document.
|
| + *
|
| + * This method is the Dart equivalent to jQuery's
|
| + * [offset](http://api.jquery.com/offset/) method.
|
| + */
|
| + Point get docOffset => offsetTo(document.documentElement);
|
| +
|
| + /**
|
| + * Provides the offset of this element's [borderEdge] relative to the
|
| + * specified [parent].
|
| + *
|
| + * This is the Dart equivalent of jQuery's
|
| + * [position](http://api.jquery.com/position/) method. Unlike jQuery's
|
| + * position, however, [parent] can be any parent element of `this`,
|
| + * rather than only `this`'s immediate offsetParent. If the specified element
|
| + * is _not_ an offset parent or transitive offset parent to this element,
|
| + * an ArgumentError is thrown.
|
| + */
|
| + Point offsetTo(Element parent) {
|
| + return _offsetToHelper(this,
|
| + parent, parent == this || parent.tagName == 'HTML');
|
| + }
|
| +
|
| + Point _offsetToHelper(Element current, Element parent, bool foundAsParent) {
|
| + if (current == null || current == parent) {
|
| + return foundAsParent? new Point(0, 0) : throw new ArgumentError(
|
| + "Specified element is not a transitive offset parent of this "
|
| + "element.");
|
| + }
|
| + Element parentOffset = current.offsetParent;
|
| + Point p = _offsetToHelper(
|
| + parentOffset, parent, foundAsParent || parentOffset == parent);
|
| + return new Point(p.x + current.offsetLeft, p.y + current.offsetTop);
|
| + }
|
| // To suppress missing implicit constructor warnings.
|
| factory Element._() { throw new UnsupportedError("Not supported"); }
|
|
|
|
|