Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-9499

Javascript function dE does not correctly detect element visibility

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.0.8-RC1
    • 3.0.6, 3.0.7, 3.0.7-PL1
    • ACP
    • None
    • PHP Version 5.2.6-3ubuntu4.5 - Tested with Google Chrome 5 Beta and Firefox 3.6

      After trying to make use of the javascript function dE() in the ACP, I discovered that it is outdated and will not correctly detect the visibility of the specified element correctly.
      In the ACP, the function dE is defined as such:

      /**
      * Set display of page element
      * s[-1,0,1] = hide,toggle display,show
      */
      function dE(n, s, type)
      {
      	if (!type)
      	{
      		type = 'block';
      	}
       
      	var e = document.getElementById(n);
      	if (!s)
      	{
      		s = (e.style.display == '') ? -1 : 1;
      	}
      	e.style.display = (s == 1) ? type : 'none';
      }
      

      In proSilver, the dE function is defined like so:

      /**
      * Set display of page element
      * s[-1,0,1] = hide,toggle display,show
      */
      function dE(n, s)
      {
      	var e = document.getElementById(n);
       
      	if (!s)
      	{
      		s = (e.style.display == '' || e.style.display == 'block') ? -1 : 1;
      	}
      	e.style.display = (s == 1) ? 'block' : 'none';
      }
      

      The main difference between the function declarations is that of this snippet:

       || e.style.display == 'block'


      Adding this into the ACP variant of the function corrected the problem for me.

      At the moment, I am about to make a quick patch via git and submit a pull request, I'll reply back to this bug when I am done.

            A_Jelly_Doughnut A_Jelly_Doughnut
            Desdenova Desdenova [X] (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: