new MenuStore(menu)
Parameters:
Name | Type | Description |
---|---|---|
menu |
ContextMenu | The context menu the store belongs to. |
- Source:
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:
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:
addTabindex(element)
Adds tabindex to an element and possibly safes an existing one.
Parameters:
Name | Type | Description |
---|---|---|
element |
HTMLElement | The DOM element. |
- Source:
clear()
Removes all elements in the store.
- Source:
getActive() → {HTMLElement}
- Source:
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:
insertElement(element)
Adds a DOM element to the store.
Parameters:
Name | Type | Description |
---|---|---|
element |
HTMLElement | The DOM element. |
- Source:
insertTaborder()
Inserts all elements in the store into the tab order.
- Source:
insertTaborder_()
Inserts all elements in the store into the tab order.
- Source:
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:
keydown(event)
Deals with key down keyboard events.
Parameters:
Name | Type | Description |
---|---|---|
event |
KeyboardEvent | The keyboard event. |
- Source:
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:
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:
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:
removeElement(element)
Removes a DOM element from the store.
Parameters:
Name | Type | Description |
---|---|---|
element |
HTMLElement | The DOM element. |
- Source:
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:
removeEvents(element)
Removes event listeners that activate the context menu from an element.
Parameters:
Name | Type | Description |
---|---|---|
element |
HTMLElement | The DOM element. |
- Source:
removeTabindex(element)
Removes tabindex from element or restores an old one.
Parameters:
Name | Type | Description |
---|---|---|
element |
HTMLElement | The DOM element. |
- Source:
removeTaborder()
Removes all elements in the store from the tab order.
- Source:
removeTaborder_()
Removes all elements in the store from the tab order.
- Source:
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:
sort()
Sorts the elements in the store in DOM order.
- Source: