Confirmed users
764
edits
(→JEP 112 - Context Menu: Added link to bug) |
(Removed universal selector limitation) |
||
Line 25: | Line 25: | ||
** A search extension adds a "Search" item when the context menu is invoked while a selection exists. | ** A search extension adds a "Search" item when the context menu is invoked while a selection exists. | ||
** An extension adds an "Open Text Link" item when the selection contains a URL outside of an anchor. | ** An extension adds an "Open Text Link" item when the selection contains a URL outside of an anchor. | ||
** An DOM inspection extension adds an "Inspect This Node" when the context menu is invoked anywhere in the page. | |||
* Adding an item that acts on the entire page. Examples: | * Adding an item that acts on the entire page. Examples: | ||
** An extension that makes it easy to edit page source adds an "Edit Page Source" item when the context menu is invoked anywhere on the page. | ** An extension that makes it easy to edit page source adds an "Edit Page Source" item when the context menu is invoked anywhere on the page. | ||
Line 76: | Line 77: | ||
Permanently removes an item previously added to the context menu. This method should not be used to temporarily remove items under particular contexts; for that, pass an appropriate [[#Specifying Contexts|context]] when you call <tt>add</tt>, <tt>insertBefore</tt>, or <tt>replace</tt>. | Permanently removes an item previously added to the context menu. This method should not be used to temporarily remove items under particular contexts; for that, pass an appropriate [[#Specifying Contexts|context]] when you call <tt>add</tt>, <tt>insertBefore</tt>, or <tt>replace</tt>. | ||
; item: A menuitem. See [[#Specifying New Menuitems]]. | ; item: A menuitem that was previously created and added to the menu. See [[#Specifying New Menuitems]]. | ||
==== replace ==== | ==== replace ==== | ||
Line 96: | Line 97: | ||
Contexts may be specified with any of the following types: | Contexts may be specified with any of the following types: | ||
; string: A CSS selector. The context arises when the menu is invoked on a node that either matches this selector or has an ancestor that matches. | ; string: A CSS selector. The context arises when the menu is invoked on a node that either matches this selector or has an ancestor that matches. The selector is scoped to the <tt>body</tt> of the page. | ||
; null: The page context. The context arises when the menu is invoked on a non-interactive portion of the page. The definition of "non-interactive" is at Jetpack's discretion. | ; null: The page context. The context arises when the menu is invoked on a non-interactive portion of the page. The definition of "non-interactive" is at Jetpack's discretion. |