blob: f4897cfe9998a230125a095a00e669cbedc39139 [file] [log] [blame]
function IsInFlow(element) {
var style = window.getComputedStyle(element);
return style.getPropertyValue("display") !== "none" &&
style.getPropertyValue("position") !== "absolute" &&
style.getPropertyValue("position") !== "fixed";
}
function firstInFlowChild(element) {
var child = element.firstElementChild;
if (!child || IsInFlow(child))
return child;
return nextInFlowSibling(child);
}
function nextInFlowSibling(element) {
var child = element;
do {
child = child.nextElementSibling;
} while (child && !IsInFlow(child));
return child;
}
function previousInFlowSibling(element) {
var child = element;
do {
child = child.previousElementSibling;
} while (child && !IsInFlow(child));
return child;
}