Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dead code removed; PDoc updated; computation of outline width added #41

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/prototype/dom/layout.js
@@ -1,4 +1,3 @@

(function() {

// Converts a CSS percentage value to a decimal.
Expand Down Expand Up @@ -113,10 +112,9 @@
context = context || element.parentNode;
var decimal = toDecimal(value);
var whole = null;
var position = element.getStyle('position');

var isHorizontal = property.include('left') || property.include('right') ||
property.include('width');
property.include('width');

var isVertical = property.include('top') || property.include('bottom') ||
property.include('height');
Expand Down Expand Up @@ -151,7 +149,6 @@

// Shortcut for figuring out if an element is `display: none` or not.
function isDisplayed(element) {
var originalElement = element;
while (element && element.parentNode) {
var display = element.getStyle('display');
if (display === 'none') {
Expand Down Expand Up @@ -215,7 +212,7 @@
*
* The following are the CSS-related properties that can be retrieved.
* Nearly all of them map directly to their property names in CSS. (The
* only exception is for borders — e.g., `border-width` instead of
* only exception is for borders — e.g., `border-left` instead of
* `border-left-width`.)
*
* * `height`
Expand All @@ -236,6 +233,7 @@
* * `margin-bottom`
* * `margin-left`
* * `margin-right`
* * `outline`
*
* In addition, these "composite" properties can be retrieved:
*
Expand Down Expand Up @@ -557,7 +555,7 @@
*
* A list of all measurable properties.
**/
PROPERTIES: $w('height width top left right bottom border-left border-right border-top border-bottom padding-left padding-right padding-top padding-bottom margin-top margin-bottom margin-left margin-right padding-box-width padding-box-height border-box-width border-box-height margin-box-width margin-box-height'),
PROPERTIES: $w('height width top left right bottom border-left border-right border-top border-bottom padding-left padding-right padding-top padding-bottom margin-top margin-bottom margin-left margin-right padding-box-width padding-box-height border-box-width border-box-height margin-box-width margin-box-height outline'),

/**
* Element.Layout.COMPOSITE_PROPERTIES = Array
Expand Down Expand Up @@ -605,6 +603,7 @@
pRight = this.get('padding-right');

if (!this._preComputing) this._end();

return bWidth - bLeft - bRight - pLeft - pRight;
},

Expand Down Expand Up @@ -738,6 +737,10 @@

'margin-right': function(element) {
return getPixelValue(element, 'marginRight');
},

'outline': function(element) {
return getPixelValue(element, 'outlineWidth');
}
}
});
Expand Down Expand Up @@ -1146,10 +1149,9 @@
* Returns the X/Y coordinates of element relative to the viewport.
**/
function viewportOffset(forElement) {
element = $(element);
var valueT = 0, valueL = 0, docBody = document.body;

var element = forElement;
var element = $(forElement);
do {
valueT += element.offsetTop || 0;
valueL += element.offsetLeft || 0;
Expand Down