-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtype-offset.js
29 lines (24 loc) · 889 Bytes
/
type-offset.js
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
// Used to retrieve the render type of the previously answered form element when constructing the output document.
function getPreviousElementRenderType(rendInd, parsedArr, rTypes)
{
var currentSearchIndex = rendInd - 1;
var currentPrev = null;
var typeRes = null;
// Loops through previously rendered elements until target found.
while (currentSearchIndex >= 0 && currentSearchIndex < parsedArr.length && typeRes === null)
{
currentPrev = parsedArr[currentSearchIndex];
if (currentPrev !== null && currentPrev.enabledFlag >= 0)
{
// Answered element.
typeRes = currentPrev.elementType;
}
else if (currentPrev !== null && currentPrev.elementType === rTypes.SECTION && currentPrev.visible === true)
{
// Visible section.
typeRes = rTypes.SECTION;
}
currentSearchIndex = currentSearchIndex - 1;
}
return typeRes;
}