blob: f4897cfe9998a230125a095a00e669cbedc39139 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
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;
}
|