Skip to content

Commit

Permalink
Merge branch 'layout'
Browse files Browse the repository at this point in the history
  • Loading branch information
savetheclocktower committed Feb 15, 2010
2 parents 5cb5ee4 + c32865f commit 6a529ac
Show file tree
Hide file tree
Showing 6 changed files with 1,160 additions and 30 deletions.
1 change: 1 addition & 0 deletions src/dom.js
Expand Up @@ -28,6 +28,7 @@

//= require "dom/dom"
//= require <selector_engine>
//= require "dom/layout"
//= require "dom/selector"
//= require "dom/form"
//= require "dom/event"
Expand Down
30 changes: 0 additions & 30 deletions src/dom/dom.js
Expand Up @@ -1061,36 +1061,6 @@ Element.Methods = {
return element;
},

/**
* Element.getDimensions(@element) -> Object
*
* Finds the computed width and height of `element` and returns them as
* key/value pairs of an object.
**/
getDimensions: function(element) {
element = $(element);
var display = Element.getStyle(element, 'display');
if (display != 'none' && display != null) // Safari bug
return {width: element.offsetWidth, height: element.offsetHeight};

// All *Width and *Height properties give 0 on elements with display none,
// so enable the element temporarily
var els = element.style,
originalVisibility = els.visibility,
originalPosition = els.position,
originalDisplay = els.display;
els.visibility = 'hidden';
if (originalPosition != 'fixed') // Switching fixed to absolute causes issues in Safari
els.position = 'absolute';
els.display = 'block';
var originalWidth = element.clientWidth,
originalHeight = element.clientHeight;
els.display = originalDisplay;
els.position = originalPosition;
els.visibility = originalVisibility;
return {width: originalWidth, height: originalHeight};
},

/**
* Element.makePositioned(@element) -> Element
*
Expand Down

0 comments on commit 6a529ac

Please sign in to comment.