Hi i have a problem, the parent and child context menu works good on page but it doesn't show child menus on selection. Thanks in advance for help.


Code:
// A generic onclick callback function.
function genericOnClick(info, tab) {
  console.log("item " + info.menuItemId + " was clicked");
  console.log("info: " + JSON.stringify(info));
  console.log("tab: " + JSON.stringify(tab));
}

// Create a parent item and two children.
var contexts = ["page","selection"];
var strona = contexts[0];
var zaznaczenie = contexts[1];
var parent = chrome.contextMenus.create({"title": "Autorefresh", "contexts":[strona]});
var child1 = chrome.contextMenus.create(
  {"title": "Child 1", "parentId": parent, "onclick": genericOnClick});
var child2 = chrome.contextMenus.create(
  {"title": "Child 2", "parentId": parent, "onclick": genericOnClick});
console.log("parent:" + parent + " child1:" + child1 + " child2:" + child2);

var parent2= chrome.contextMenus.create({"title": "Autorefresh", "contexts":[zaznaczenie]});
var child3 = chrome.contextMenus.create(
  {"title": "Child 3", "parentId": parent2, "onclick": genericOnClick});
var child4 = chrome.contextMenus.create(
  {"title": "Child 4", "parentId": parent2, "onclick": genericOnClick});
console.log("parent2:" + parent2 + " child3:" + child3 + " child4:" + child4);