Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-14163

Select All in code bug in Edge

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 3.1.6
    • 3.1.7-RC1
    • None
    • None
    • PHP 5.2.3, MySQL 5.1.3, Microsoft Edge

    Description

      I updated my forum but the bugfix for Edge was just a replace of the bug by 1 => "Select all" just select one line..

      So here is my bugfix :
      In prosilver Template directory, the forum_fn.js file.

      The function in 3.1.6 Prosilver Template :
      function selectCode(a) {
      2. 'use strict';
      3.
      4. // Get ID of code block
      5. var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0];
      6. var s, r;
      7.
      8. // Not IE and IE9+
      9. if (window.getSelection) {
      10. s = window.getSelection();
      11. // Safari and Chrome
      12. if (s.setBaseAndExtent) {
      13. var l = (e.innerText.length > 1) ? e.innerText.length - 1 : 1;
      14. try

      { 15. s.setBaseAndExtent(e, 0, e, l); 16. }

      catch (error)

      { 17. s.setBaseAndExtent(e, 0, e, 1); 18. }

      19. }
      20. // Firefox and Opera
      21. else {
      22. // workaround for bug # 42885
      23. if (window.opera && e.innerHTML.substring(e.innerHTML.length - 4) === '<BR>')

      { 24. e.innerHTML = e.innerHTML + ' '; 25. }

      26.
      27. r = document.createRange();
      28. r.selectNodeContents(e);
      29. s.removeAllRanges();
      30. s.addRange(r);
      31. }
      32. }
      33. // Some older browsers
      34. else if (document.getSelection)

      { 35. s = document.getSelection(); 36. r = document.createRange(); 37. r.selectNodeContents(e); 38. s.removeAllRanges(); 39. s.addRange(r); 40. }

      41. // IE
      42. else if (document.selection)

      { 43. r = document.body.createTextRange(); 44. r.moveToElementText(e); 45. r.select(); 46. }

      47.}

      Just replace line 17 "s.setBaseAndExtent(e, 0, e, 1);"
      by :
      r = document.createRange();
      r.selectNodeContents(e);
      s.removeAllRanges();
      s.addRange(r);

      And voilĂ  !

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: