Skip to content

Instantly share code, notes, and snippets.

@brendandahl
Last active February 28, 2018 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brendandahl/50a1ce7830d8ac333ceffe34ada98b14 to your computer and use it in GitHub Desktop.
Save brendandahl/50a1ce7830d8ac333ceffe34ada98b14 to your computer and use it in GitHub Desktop.
XUL overlay within an Overlay

Say there are two overlays placesOverlay.xul and macBrowserOverlay.xul and a master document aboutDialog.xul. The relationship is: aboutDialog.xul includes macBrowserOverlay.xul and macBrowserOverlay.xul includes placesOverlay.xul.

Example 1

placesOverlay.xul

<commandset id="zzz">
  <command id="zzzPlacesOverlay"/>
</commandset>

macBrowserOverlay.xul

<?xul-overlay href="placesOverlay.xul"?>

aboutDialog.xul

<?xul-overlay href="macBrowserOverlay.xul"?>
<commandset id="zzz">
  <command id="zzzAboutDialog"/>
</commandset>

The resulting aboutDialog.xul would be:

<commandset id="zzz">
  <command id="zzzAboutDialog"/>
  <command id="zzzPlacesOverlay"/>
</commandset>

Key takeaway: overalys within overlays apply to the master document. The top level overaly does not just apply to the overlay that includes it.

Example 2

Let's say the macBrowserOverlay.xul also defines a <commandset id="zzz">.

macBrowserOverlay.xul

<?xul-overlay href="placesOverlay.xul"?>
<commandset id="zzz">
  <command id="zzzMacBrowserOverlay"/>
</commandset>

The result would be:

<commandset id="zzz">
  <command id="zzzAboutDialog"/>
  <command id="zzzMacBrowserOverlay"/>
  <command id="zzzPlacesOverlay"/>
</commandset>

Key takeaway: overalys are applied bottom up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment