PATCH: Fix JavaScript menus

Mark Mitchell mark at codesourcery.com
Tue Feb 25 00:27:15 UTC 2003


This patch (checked in to the 2.0 branch and the mainline) fixes the
problem that some people have had with the JavaScript menus not
working correctly in Mozilla.

We'll be spinning a new 2.0.3 release shortly with this fix, and the
fix for parallel runs.

--
Mark Mitchell
CodeSourcery, LLC
mark at codesourcery.com

2003-02-24  Mark Mitchell  <mark at codesourcery.com>

	* qm/test/share/dtml/navigation-bar.dtml (hide_menu): Tweak for
	Mozilla 1.0.1 compatibility.

Index: qm/test/share/dtml/navigation-bar.dtml
===================================================================
RCS file: /home/sc/Repository/qm/qm/test/share/dtml/navigation-bar.dtml,v
retrieving revision 1.5
diff -c -5 -p -r1.5 navigation-bar.dtml
*** qm/test/share/dtml/navigation-bar.dtml	1 Jan 2003 03:38:45 -0000	1.5
--- qm/test/share/dtml/navigation-bar.dtml	25 Feb 2003 00:09:14 -0000
*************** function show_menu(event, id) {
*** 77,103 ****
          active_menu.style.visibility = "hidden";
      menu.style.visibility = "visible";
      active_menu = menu;
  }
  
  
  function hide_menu(event) {
      var target;
    
      if (window.event) {
          target = window.event.toElement;
      } else {
          target = event.relatedTarget;
      }
!     if (!is_parent_of(this, target))
          this.style.visibility = "hidden";
  }
  
  
  function hide_active_menu(event) {
      var target;
  
      if (!active_menu)
          return;
    
      if (window.event) {
          target = window.event.toElement;
--- 77,109 ----
          active_menu.style.visibility = "hidden";
      menu.style.visibility = "visible";
      active_menu = menu;
  }
  
+ /* Called when the mouseout event is received by a menu.  */
  
  function hide_menu(event) {
      var target;
    
+     /* Figure out to which element the mouse is moving.  */
      if (window.event) {
          target = window.event.toElement;
      } else {
          target = event.relatedTarget;
      }
!     /* If that element is not a child of the menu, hide the menu.  */
!     if (target && !is_parent_of(this, target))
          this.style.visibility = "hidden";
  }
  
+ /* Called when an item on the menu bar is activated.  The event is
+    either a mouseover or onclick event.  */
  
  function hide_active_menu(event) {
      var target;
  
+     /* If there is no active menu, there's nothing to hide.  */
      if (!active_menu)
          return;
    
      if (window.event) {
          target = window.event.toElement;



More information about the qmtest mailing list