| SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ClassName functions are added to APE.dom.
| Method Summary | |
|---|---|
|
convertPixelToEmEx(parentNode, prop, val, computedStyle)
Used for converting getComputedStyle(el,"") value to an em value. |
HTMLElement
|
findAncestorWithAttribute(el, attName, value)
|
String
|
findInheritedStyle(el, prop, units)
findInheritedStyle tries to find a cascaded style value for the element. |
String
|
getCascadedStyle(el, p, desiredUnit)
Cross-browser adapter method for reading style. |
HTMLElement
|
getContainingBlock(el)
Finds the containing block of el, as per CSS 2.1 sec 10.1 |
boolean
|
getContains()
|
ufloat
|
getFilterOpacity(el)
Special method for a browser that supports el.filters and not style.opacity. |
x:Number, y:Number
|
getOffsetCoords(el, positionedContainer, coords)
|
|
getScrollOffsets()
|
String
|
getStyle(el, p)
returns the computed style of property p of el.
|
String
|
getStyleUnit(value)
|
|
getViewportDimensions()
|
boolean
|
isAboveElement(a, b)
|
boolean
|
isBelowElement(a, b)
|
boolean
|
isInsideElement(a, b)
|
ufloat
|
setOpacity(el, i)
Cross-browser adapter method for style.filters vs style.opacity. |
| Method Detail |
|---|
convertPixelToEmEx(parentNode, prop, val, computedStyle)
HTMLElement parentNode
String prop - style property to work with.
String val - the value, such as "12.3px".
ComputedCSSStyleDeclaration computedStyle - object to work with.
HTMLElement findAncestorWithAttribute(el, attName, value)
HTMLElement el - the element to start from.
String attName - the name of the attribute.
String value? - the value of the attribute. If omitted, then only the
presence of attribute is checked and the value is anything.
HTMLElement closest ancestor with attName matching value.
Returns null if not found.
String findInheritedStyle(el, prop, units)
Element el - - element's style you want.
String prop - style property, such as backgroundColor.
String units? - optional unit to search for. Example: "em".
String computed style or an empty string.
String getCascadedStyle(el, p, desiredUnit)
currentStyle
(Firefox/Safari) pass in a desiredUnit of either em or
ex
HTMLElement el - the element to set opacity on.
String p - the property to retrieve.
String desiredUnit - one of: ["em", ] the type of unit to retrieve/compute -
this is not really supported in IE - it is mostly for browsers that don't support
currentStyle.
String the cascaded style value or the empty string if no value was found.
HTMLElement getContainingBlock(el)
HTMLElement el
HTMLElement el's containing block.
boolean getContains()
boolean true if a contains b.
Internet Explorer's native contains() is different. It will return true for:
code body.contains(body);
Whereas APE.dom.contains will return false.
ufloat getFilterOpacity(el)
HTMLElement el - the element to find opacity on.
ufloat [0-1] amount of opacity.
calling this method on a browser that does not support filters
results in 1 being returned. Use dom.getStyle or dom.getCascadedStyle instead
x:Number, y:Number getOffsetCoords(el, positionedContainer, coords)
HTMLElement el - you want coords of.
HTMLElement positionedContainer - container to look up to. The container must have
position: (relative|absolute|fixed);
x:Number, y:Number coords - object to pass in.
x:Number, y:Number coords of el from container.
Passing in a container will improve performance in browsers that don't support
getBoundingClientRect, but those that do will have a recursive call. Test accordingly.
Container is sometimes irrelevant. Container is irrelevant when comparing positions of objects who do not share a common ancestor. In this case, pass in document.
Passing in re-used coords can improve performance in all browsers. There is a side effect to passing in coords: For drag drop operations, reuse coords:
// Update our coords: dom.getOffsetCoords(el, container, this.coords);Where
this.coords = {};
getScrollOffsets()
an object with width and height.
This will exhibit a bug in Mozilla, which is often 5-7 pixels off.
String getStyle(el, p)
p of el.
Returns different results in IE, so user beware! If your
styleSheet has units like "em" or "in", this method does
not attempt to convert those to px.
Use "cssFloat" for getting an element's float and special
"filters" treatment for "opacity".
HTMLElement el - the element to set opacity on.
String p - the property to retrieve.
String the computed style value or the empty string if no value was found.
String getStyleUnit(value)
String value - a string value of a measurement. Example: 5em
String The unit portion of the string. If no matching unit is found,
then the empty string is returned.
getViewportDimensions()
an object with width and height.
This will exhibit a bug in Mozilla, which is often 5-7 pixels off.
boolean isAboveElement(a, b)
a
b
boolean true if a overlaps the top of b's content area.
boolean isBelowElement(a, b)
a
b
boolean true if a overlaps the bottom of b's content area.
boolean isInsideElement(a, b)
a
b
boolean true if a is vertically within b's content area (and does not overlap,
top nor bottom).
ufloat setOpacity(el, i)
HTMLElement el - the element to set opacity on.
ufloat i - [0-1] the amount of opacity.
ufloat [0-1] amount of opacity.