Labs/Jetpack/Reboot/JEP/112: Difference between revisions

Jump to navigation Jump to search
A couple of corrections
(Status -> Accepted/Pre-Production)
(A couple of corrections)
Line 100: Line 100:
; 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.


; function: An arbitrary predicate.  The context arises when the function returns true.  The function is called with no arguments.
; function: An arbitrary predicate.  The context arises when the function returns true.  The function is passed an object describing the current context.  See [[#Context_Descriptions]].


Instead of requiring consumers to manually add and remove items when particular contexts arise, this proposal introduces the notion that items are bound to one or more contexts, much as event listeners are bound to events.  This binding occurs through an item's <tt>context</tt> property.  When the context menu is invoked, all of the items bound to the context giving rise to the menu are added to the menu.  If no items are bound to the context, no items are added to the menu.
Instead of requiring consumers to manually add and remove items when particular contexts arise, this proposal introduces the notion that items are bound to one or more contexts, much as event listeners are bound to events.  This binding occurs through an item's <tt>context</tt> property.  When the context menu is invoked, all of the items bound to the context giving rise to the menu are added to the menu.  If no items are bound to the context, no items are added to the menu.
Line 148: Line 148:
<blockquote>
<blockquote>


; context: If the item is added to the top-level context menu, this specifies the context under which the item will appear.  See [[#Specifying Contexts]].  This property is ignored if the item is contained in a submenu.
; context: If the item is added to the top-level context menu, this specifies the context under which the item will appear.  See [[#Specifying Contexts]].  If undefined, the page context is assumed.  This property is ignored if the item is contained in a submenu.


; data: An optional, arbitrary string that the extension may associate with the menuitem.
; data: An optional, arbitrary string that the extension may associate with the menuitem.
Line 170: Line 170:
<blockquote>
<blockquote>


; context: If the item is added to the top-level context menu, this specifies the context under which the item will appear.  See [[#Specifying Contexts]].  This property is ignored if the item is contained in a submenu.
; context: If the item is added to the top-level context menu, this specifies the context under which the item will appear.  See [[#Specifying Contexts]].  If undefined, the page context is assumed.  This property is ignored if the item is contained in a submenu.


; icon: The URL of an icon to display in the menuitem.  Optional.  Note that some environments, [https://bugzilla.mozilla.org/show_bug.cgi?id=527253 notably Gnome 2.28], do not support menuitem icons either by default or at all.
; icon: The URL of an icon to display in the menuitem.  Optional.  Note that some environments, [https://bugzilla.mozilla.org/show_bug.cgi?id=527253 notably Gnome 2.28], do not support menuitem icons either by default or at all.
Line 184: Line 184:
==== Separator ====
==== Separator ====


<tt>Separator()</tt>
<tt>Separator(options)</tt>


The <tt>Separator</tt> constructor creates menu separators.  It takes no arguments.
The <tt>Separator</tt> constructor creates menu separators.
 
; options: An object that defines the following properties:
 
<blockquote>
 
; context: If the item is added to the top-level context menu, this specifies the context under which the item will appear.  See [[#Specifying Contexts]].  If undefined, the page context is assumedThis property is ignored if the item is contained in a submenu.
 
</blockquote>


=== Specifying Existing Menuitems ===
=== Specifying Existing Menuitems ===
Confirmed users
764

edits

Navigation menu