rem:   while (selectedItem.localName == "treeitem") { if (selectedItem.getAttribute("container") == "true") 
add: while (selectedItem && selectedItem.nodeType == Node.ELEMENT_NODE) { if (selectedItem.getAttribute("container") == "true" && selectedItem.getAttribute("open") == "true") 
context:   getSelectedFolder: function ()  {    var selectedItem = this.getBestItem();    if (!selectedItem) return "NC:BookmarksRoot";    // If we don't check for localName we walk the DOM tree up to the window node,    // which is Bad.    while (selectedItem.localName == "treeitem") {      if (selectedItem.getAttribute("container") == "true")        return NODE_ID(selectedItem);      selectedItem = selectedItem.parentNode.parentNode;    }    return "NC:BookmarksRoot";  },
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/6051379e1540c9c96535a645412820d120f50413/bookmarksTree.js/clean/xpfe/components/bookmarks/resources/bookmarksTree.js