Skip to content

Commit

Permalink
doc: Merge/update old docs for Elements.Methods offset/positioning fu…
Browse files Browse the repository at this point in the history
…nctions into source [#78 state:fixed_in_branch]
  • Loading branch information
dandean authored and samleb committed Mar 2, 2010
1 parent f484b5e commit ab1663a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/dom/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -2286,6 +2286,9 @@ Element.Methods = {
* Allows for the easy creation of a CSS containing block by setting
* `element`'s CSS `position` to `relative` if its initial position is
* either `static` or `undefined`.
*
* To revert back to `element`'s original CSS position, use
* [[Element.undoPositioned]].
**/
makePositioned: function(element) {
element = $(element);
Expand All @@ -2308,6 +2311,10 @@ Element.Methods = {
*
* Sets `element` back to the state it was in _before_
* [[Element.makePositioned]] was applied to it.
*
* `element`'s absolutely positioned children will now have their positions
* set relatively to `element`'s nearest ancestor with a CSS `position` of
* `'absolute'`, `'relative'` or `'fixed'`.
**/
undoPositioned: function(element) {
element = $(element);
Expand Down Expand Up @@ -2467,6 +2474,13 @@ Element.Methods = {
*
* Returns an array in the form of `[leftValue, topValue]`. Also accessible
* as properties: `{ left: leftValue, top: topValue }`.
*
* Calculates the cumulative `offsetLeft` and `offsetTop` of an element and
* all its parents _until_ it reaches an element with a position other than
* `static`.
*
* Note that all values are returned as _numbers only_ although they are
* _expressed in pixels_.
**/
positionedOffset: function(element) {
var valueT = 0, valueL = 0;
Expand Down Expand Up @@ -2573,6 +2587,9 @@ Element.Methods = {
*
* Returns `element`'s closest _positioned_ ancestor. If none is found, the
* `body` element is returned.
*
* The returned element is `element`'s
* [CSS containing block](http://www.w3.org/TR/CSS21/visudet.html#containing-block-details).
**/
getOffsetParent: function(element) {
if (element.offsetParent) return $(element.offsetParent);
Expand Down

0 comments on commit ab1663a

Please sign in to comment.