JSDoc: Class: MenuStore

# Class: MenuStore

## MenuStore

#### new MenuStore(menu)

##### Parameters:

Name | Type | Description
--- | --- | ---
`menu` | ContextMenu | The context menu the store belongs to.

Source:
  - menu_store.js, line 31

### Methods

#### addEvent(element, name, func)

Adds a single event listeners and stores them in the attribute mapping.

##### Parameters:

Name | Type | Description
--- | --- | ---
`element` | HTMLElement | The DOM element.
`name` | string | The name of the event handler.
`func` | EventListener | The event listener.

Source:
  - menu_store.js, line 253

#### addEvents(element)

Adds event listeners to activate the context menu to an element. To be able to remove event listeners we have to remember exactly which listeners we have added. We safe them in the attribute mapping attrMap, as a combination of event handler name and counter, which is unique for each HTML element. The counter is stored on the HTML element in an attribute.

##### Parameters:

Name | Type | Description
--- | --- | ---
`element` | HTMLElement | The DOM element.

Source:
  - menu_store.js, line 238

#### addTabindex(element)

Adds tabindex to an element and possibly safes an existing one.

##### Parameters:

Name | Type | Description
--- | --- | ---
`element` | HTMLElement | The DOM element.

Source:
  - menu_store.js, line 207

#### clear()

Removes all elements in the store.

Source:
  - menu_store.js, line 98

#### getActive() → {HTMLElement}

Source:
  - menu_store.js, line 57

##### Returns:

The currently active store element, if one exists.

Type
  HTMLElement

#### insert(elementOrList)

Inserts DOM elements into the store.

##### Parameters:

Name | Type | Description
--- | --- | ---
`elementOrList` | HTMLElement | Array.<HTMLElement> | NodeList | Elements to insert.

Source:
  - menu_store.js, line 106

#### insertElement(element)

Adds a DOM element to the store.

##### Parameters:

Name | Type | Description
--- | --- | ---
`element` | HTMLElement | The DOM element.

Source:
  - menu_store.js, line 160

#### insertTaborder()

Inserts all elements in the store into the tab order.

Source:
  - menu_store.js, line 143

#### insertTaborder_()

Inserts all elements in the store into the tab order.

Source:
  - menu_store.js, line 194

#### inTaborder(flag)

Sets if elements of the store are included in the taborder or not.

##### Parameters:

Name | Type | Description
--- | --- | ---
`flag` | boolean | If true elements are in taborder, o/w not.

Source:
  - menu_store.js, line 131

#### keydown(event)

Deals with key down keyboard events.

##### Parameters:

Name | Type | Description
--- | --- | ---
`event` | KeyboardEvent | The keyboard event.

Source:
  - menu_store.js, line 287

#### next() → {HTMLElement}

Returns next active element. If store is empty returns null and also unsets active element. If active is not set returns the first element of the store.

Source:
  - menu_store.js, line 66

##### Returns:

The next element if it exists.

Type
  HTMLElement

#### previous() → {HTMLElement}

Returns previous active element. If store is empty returns null and also unsets active element. If active is not set returns the last element of the store.

Source:
  - menu_store.js, line 83

##### Returns:

The previous element if it exists.

Type
  HTMLElement

#### remove(elementOrList)

Removes DOM elements from the store.

##### Parameters:

Name | Type | Description
--- | --- | ---
`elementOrList` | HTMLElement | Array.<HTMLElement> | NodeList | Elements to remove.

Source:
  - menu_store.js, line 119

#### removeElement(element)

Removes a DOM element from the store.

##### Parameters:

Name | Type | Description
--- | --- | ---
`element` | HTMLElement | The DOM element.

Source:
  - menu_store.js, line 174

#### removeEvent(element, name, counter)

Removes a single event listeners from an HTML element.

##### Parameters:

Name | Type | Description
--- | --- | ---
`element` | HTMLElement | The DOM element.
`name` | string | The name of the event handler.
`counter` | string | The unique counter to identify the handler in the attribute mappings.

Source:
  - menu_store.js, line 278

#### removeEvents(element)

Removes event listeners that activate the context menu from an element.

##### Parameters:

Name | Type | Description
--- | --- | ---
`element` | HTMLElement | The DOM element.

Source:
  - menu_store.js, line 262

#### removeTabindex(element)

Removes tabindex from element or restores an old one.

##### Parameters:

Name | Type | Description
--- | --- | ---
`element` | HTMLElement | The DOM element.

Source:
  - menu_store.js, line 217

#### removeTaborder()

Removes all elements in the store from the tab order.

Source:
  - menu_store.js, line 151

#### removeTaborder_()

Removes all elements in the store from the tab order.

Source:
  - menu_store.js, line 200

#### setActive(element)

Sets the new active store element if it exists in the store.

##### Parameters:

Name | Type | Description
--- | --- | ---
`element` | HTMLElement | Element to be activated.

Source:
  - menu_store.js, line 45

#### sort()

Sorts the elements in the store in DOM order.

Source:
  - menu_store.js, line 187