New menu with a container for mutliple always available non scrollable items
Change-Id: I5c8379cc82038da4a6c0923bbf59ec8faaa1eb9f
diff --git a/dev/js/src/menu.js b/dev/js/src/menu.js
index 4e93390..86a8105 100644
--- a/dev/js/src/menu.js
+++ b/dev/js/src/menu.js
@@ -55,7 +55,6 @@
// Initialize list
_init : function (list, params) {
-
if (params === undefined)
params = {};
@@ -130,8 +129,6 @@
t._items = new Array(); //all childNodes, i.e. ItemClass, prefixClass
- // TODO:
- // Make this separate from _init
t.readItems(list);
t.dontHide = false;
@@ -639,10 +636,13 @@
removeItems : function () {
const liElements=this._el.getElementsByTagName("LI");
- for (let ii = liElements.length-1; ii >= 0; ii-- ) {
- if (liElements[ii].parentNode === this._el){
- this._el.removeChild(liElements[ii]);
- };
+ var ignoredCount = 0; //counts how many LI tag elements are not actually direct children
+ while (liElements.length>ignoredCount){
+ if (liElements[ignoredCount].parentNode === this._el){
+ this._el.removeChild(liElements[ignoredCount]);
+ } else {
+ ignoredCount++;
+ }
};
},
@@ -895,6 +895,7 @@
// Remove the HTML node from the first item
// leave lengthField/prefix/slider
+ //console.log("_showItems, at _notItemElements is: ",t._el.children[this._notItemElements]);
t._el.removeChild(t._el.children[this._notItemElements]);
t._append(
@@ -907,6 +908,7 @@
t.offset = off;
// Remove the HTML node from the last item
+ //console.log("_showItems, at lastChild is: ",t._el.lastChild);
t._el.removeChild(t._el.lastChild);
t._prepend(t._list[t.offset]);