MozillaZine

Code: SELECT ALL stops working

Talk about stuff specific to the site -- bugs, suggestions, and of course praise welcome.
Alice0775

User avatar
 
Posts: 2427
Joined: October 26th, 2007, 11:25 pm
Location: OSAKA

Post Posted March 20th, 2017, 1:35 pm

Code: SELECT ALL stops working since Firefox53beta and Chrome Dev ver.58.0.3026.3.

See detail:
http://forums.mozillazine.org/viewtopic.php?p=14738754#p14738754 wrote:
avada wrote:There's another weird thing I noticed recently. The select all feature in forums, such as with the code "sections" on this forums don't work. The page is just scrolled to the top.


Chrome Dev ver.58.0.3026.3 is also same behavior.

This behavior was introduced by the following bug:
[*]#1321623[Core:Selection]-Implement setBaseAndExtent[Uns][[platform-rel-Google][platform-rel-GoogleSuite][platform-rel-GoogleDocs] ]

And, I think Mozillazine needs to update phpBB code forum_fn.js.
Mozilla products are unreliable!!!!

If it ain't broke, don't fix it. Stop rapid release without automated test!
Now, Firefox lacks reliability. Storm of regression bugs. Let's switch to Chrome.

-Arch-

User avatar
 
Posts: 907
Joined: April 11th, 2014, 7:34 pm
Location: Melbourne Australia

Post Posted March 20th, 2017, 4:04 pm

if thats the case, wouldnt it be just easier to apply a Updated forum software?

Alice0775

User avatar
 
Posts: 2427
Joined: October 26th, 2007, 11:25 pm
Location: OSAKA

Post Posted March 20th, 2017, 5:08 pm

-Arch- wrote:if thats the case, wouldnt it be just easier to apply a Updated forum software?



It will work again when replace "function selectCode" in styles/prosilver/template/forum_fn.js.

Code: Select all
function selectCode(a)
{
   // Get ID of code block
   var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0];

   // Not IE and IE9+
   if (window.getSelection)
   {
      var s = window.getSelection();
      // Safari
      if (s.setBaseAndExtent)
      {
         s.setBaseAndExtent(e, 0, e, e.innerText.length - 1);
      }
      // Firefox and Opera
      else
      {
         // workaround for bug # 42885
         if (window.opera && e.innerHTML.substring(e.innerHTML.length - 4) == '<BR>')
         {
            e.innerHTML = e.innerHTML + '&nbsp;';
         }

         var r = document.createRange();
         r.selectNodeContents(e);
         s.removeAllRanges();
         s.addRange(r);
      }
   }
   // Some older browsers
   else if (document.getSelection)
   {
      var s = document.getSelection();
      var r = document.createRange();
      r.selectNodeContents(e);
      s.removeAllRanges();
      s.addRange(r);
   }
   // IE
   else if (document.selection)
   {
      var r = document.body.createTextRange();
      r.moveToElementText(e);
      r.select();
   }
}


to

Code: Select all
function selectCode(a) {
   'use strict';

   // Get ID of code block
   var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0];
   var s, r;

   // Not IE and IE9+
   if (window.getSelection) {
      s = window.getSelection();
      // Safari and Chrome
      if (s.setBaseAndExtent) {
         var l = (e.innerText.length > 1) ? e.innerText.length - 1 : 1;
         try {
            s.setBaseAndExtent(e, 0, e, l);
         } catch (error) {
            r = document.createRange();
            r.selectNodeContents(e);
            s.removeAllRanges();
            s.addRange(r);
         }
      }
      // Firefox and Opera
      else {
         // workaround for bug # 42885
         if (window.opera && e.innerHTML.substring(e.innerHTML.length - 4) === '<BR>') {
            e.innerHTML = e.innerHTML + '&nbsp;';
         }

         r = document.createRange();
         r.selectNodeContents(e);
         s.removeAllRanges();
         s.addRange(r);
      }
   }
   // Some older browsers
   else if (document.getSelection) {
      s = document.getSelection();
      r = document.createRange();
      r.selectNodeContents(e);
      s.removeAllRanges();
      s.addRange(r);
   }
   // IE
   else if (document.selection) {
      r = document.body.createTextRange();
      r.moveToElementText(e);
      r.select();
   }
}


(The code is extracted from https://github.com/phpbb/phpbb/blob/mas ... orum_fn.js)
Mozilla products are unreliable!!!!

If it ain't broke, don't fix it. Stop rapid release without automated test!
Now, Firefox lacks reliability. Storm of regression bugs. Let's switch to Chrome.

-Arch-

User avatar
 
Posts: 907
Joined: April 11th, 2014, 7:34 pm
Location: Melbourne Australia

Post Posted March 20th, 2017, 5:12 pm

but my guess Kerz would have to do that?

Return to MozillaZine Site Discussion


Who is online

Users browsing this forum: Google [Bot] and 5 guests