Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
doc: Merge/update old docs for document.viewport into source [prototy…
…pejs#92 state:fixed_in_branch]
  • Loading branch information
dandean authored and samleb committed Jan 9, 2010
1 parent e7e4842 commit 717590a
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/dom/dom.js
Expand Up @@ -2309,9 +2309,16 @@ document.viewport = {
/**
* document.viewport.getDimensions() -> Object
*
* Returns the size of the viewport.
* Returns an object containing viewport dimensions in the form
* `{ width: Number, height: Number }`.
*
* Returns an object of the form `{ width: Number, height: Number }`.
* The _viewport_ is the subset of the browser window that a page occupies
* — the "usable" space in a browser window.
*
* ##### Example
*
* document.viewport.getDimensions();
* //-> { width: 776, height: 580 }
**/
getDimensions: function() {
return { width: this.getWidth(), height: this.getHeight() };
Expand All @@ -2324,6 +2331,15 @@ document.viewport = {
*
* Returns an array in the form of `[leftValue, topValue]`. Also accessible
* as properties: `{ left: leftValue, top: topValue }`.
*
* ##### Examples
*
* document.viewport.getScrollOffsets();
* //-> { left: 0, top: 0 }
*
* window.scrollTo(0, 120);
* document.viewport.getScrollOffsets();
* //-> { left: 0, top: 120 }
**/
getScrollOffsets: function() {
return Element._returnOffset(
Expand Down Expand Up @@ -2360,13 +2376,17 @@ document.viewport = {
* document.viewport.getWidth() -> Number
*
* Returns the width of the viewport.
*
* Equivalent to calling `document.viewport.getDimensions().width`.
**/
viewport.getWidth = define.curry('Width');

/**
* document.viewport.getHeight() -> Number
*
* Returns the height of the viewport.
*
* Equivalent to `document.viewport.getDimensions().height`.
**/
viewport.getHeight = define.curry('Height');
})(document.viewport);
Expand Down

0 comments on commit 717590a

Please sign in to comment.