/** Test for Bug 886646 - Offsets for sticky positioning, when accessed through
* getComputedStyle(), should be accurately computed. In particular,
* percentage offsets should be computed in terms of the scroll container's
* content box. */
// Test that percentage sticky offsets are computed in terms of the
// scroll container's content box var offsets = { "top": 10, "left": 20, "bottom": 30, "right": 40,
};
var scroller = document.getElementById("scroller"); var container = document.getElementById("container"); var sticky = document.getElementById("sticky"); var cs = getComputedStyle(sticky, "");
for (var prop in offsets) {
sticky.style[prop] = offsets[prop] + "%";
is(cs[prop], offsets[prop] + "px");
}
// ... even in the presence of scrollbars
scroller.style.overflow = "scroll";
container.style.width = "100%";
container.style.height = "100%";
var ccs = getComputedStyle(container, "");
function isApproximatelyEqual(a, b) {
return Math.abs(a - b) < 0.001;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.