1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/webidl/HTMLMenuElement.webidl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,59 @@ 1.4 +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this file, 1.7 + * You can obtain one at http://mozilla.org/MPL/2.0/. 1.8 + * 1.9 + * The origin of this IDL file is 1.10 + * http://www.whatwg.org/specs/web-apps/current-work/#the-menu-element 1.11 + * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis 1.12 + * 1.13 + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and 1.14 + * Opera Software ASA. You are granted a license to use, reproduce 1.15 + * and create derivative works of this document. 1.16 + */ 1.17 + 1.18 +interface MenuBuilder; 1.19 + 1.20 +// http://www.whatwg.org/specs/web-apps/current-work/#the-menu-element 1.21 +interface HTMLMenuElement : HTMLElement { 1.22 + [SetterThrows] 1.23 + attribute DOMString type; 1.24 + [SetterThrows] 1.25 + attribute DOMString label; 1.26 +}; 1.27 + 1.28 +// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis 1.29 +partial interface HTMLMenuElement { 1.30 + [SetterThrows] 1.31 + attribute boolean compact; 1.32 +}; 1.33 + 1.34 +// Mozilla specific stuff 1.35 +partial interface HTMLMenuElement { 1.36 + /** 1.37 + * Creates and dispatches a trusted event named "show". 1.38 + * The event is not cancelable and does not bubble. 1.39 + * See http://www.whatwg.org/specs/web-apps/current-work/multipage/interactive-elements.html#context-menus 1.40 + */ 1.41 + [ChromeOnly] 1.42 + void sendShowEvent(); 1.43 + 1.44 + /** 1.45 + * Creates a native menu builder. The builder type is dependent on menu type. 1.46 + * Currently, it returns nsXULContextMenuBuilder for context menus. 1.47 + * Toolbar menus are not yet supported (the method returns null). 1.48 + */ 1.49 + [ChromeOnly] 1.50 + MenuBuilder createBuilder(); 1.51 + 1.52 + /* 1.53 + * Builds a menu by iterating over menu children. 1.54 + * See http://www.whatwg.org/specs/web-apps/current-work/multipage/interactive-elements.html#building-menus-and-toolbars 1.55 + * The caller can use a native builder by calling createBuilder() or provide 1.56 + * a custom builder that implements the nsIMenuBuilder interface. 1.57 + * A custom builder can be used for example to build native context menus 1.58 + * that are not defined using <menupopup>. 1.59 + */ 1.60 + [ChromeOnly] 1.61 + void build(MenuBuilder aBuilder); 1.62 +};