/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; // This is loaded into all XUL windows. Wrap in a block to prevent // leaking to window scope. { const KEEP_CHILDREN = new Set([ "observes", "template", "menupopup", "panel", "tooltip", ]); window.addEventListener( "popupshowing", e => { if (e.originalTarget.ownerDocument != document) { return; } e.originalTarget.setAttribute("hasbeenopened", "true"); for (let el of e.originalTarget.querySelectorAll("toolbarbutton")) { el.render(); } }, { capture: true } ); class MozToolbarbutton extends MozElements.ButtonBase { static get inheritedAttributes() { // Note: if you remove 'wrap' or 'label' from the inherited attributes, // you'll need to add them to observedAttributes. return { ".toolbarbutton-icon": "validate,src=image,label,type,consumeanchor,triggeringprincipal=iconloadingprincipal", ".toolbarbutton-text": "accesskey,crop,dragover-top,wrap", ".toolbarbutton-menu-dropmarker": "disabled,label", ".toolbarbutton-badge": "text=badge,style=badgeStyle", }; } static get fragment() { let frag = document.importNode( MozXULElement.parseXULToFragment(` `), true ); Object.defineProperty(this, "fragment", { value: frag }); return frag; } static get badgedFragment() { let frag = document.importNode( MozXULElement.parseXULToFragment(`