3 var ret = new String();
4 for (var i = 0; i < depth; ++i)
9 function dumpList(list)
11 return processList(list, dumpListItemAsHTML, 0);
14 function filterListsWithReplacement(lists, processListItemFunction)
16 processListItemFunction = processListItemFunction || dumpListItemAsHTML;
17 for (var i = 0; i < lists.length; ++i) {
18 var parentNode = lists[i].parentNode;
19 var replacementNode = document.createElement("div");
20 var result = processList(lists[i], processListItemFunction, 0);
21 replacementNode.innerHTML = result;
22 parentNode.replaceChild(replacementNode, lists[i]);
26 function processList(element, processListItemFunction, depth)
29 for (var child = element.firstElementChild; child; child = child.nextElementSibling) {
30 result += processListItemFunction(child, depth);
31 result += processList(child, processListItemFunction, depth + 1);
36 function dumpListItemAsHTML(listItemElement, depth)
38 var marker = internals.markerTextForListItem(listItemElement);
39 return marker ? indent(depth) + ' ' + marker + ' ' + listItemElement.innerText.trim() + '<br/>' : '';
42 function testListItemMarkerEqualsListItemText(listItemElement, depth)
44 return testListItemMarkerEquals(internals.markerTextForListItem(listItemElement), listItemElement.innerText.trim());
47 function testListItemMarkerEquals(actualMarkerText, expectedMarkerText)
49 if (actualMarkerText === expectedMarkerText)
50 return '<span><span class="pass">PASS</span> list marker is ' + expectedMarkerText + '.</span><br/>';
51 return '<span><span class="fail">FAIL</span> list marker should be ' + expectedMarkerText + '. Was ' + actualMarkerText + '.</span><br/>';