WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Bug with the forum  (Read 1814 times)

Offline polikuo

  • Hero Member
  • *****
  • Posts: 739
Bug with the forum
« on: September 05, 2017, 12:10:08 AM »
P.S.
Is it just me or the "Code: [Select]" button of the forum no longer works with the latest firefox ?
"Select" Doesn't work for me either in Firefox 55.0.3,  but am not sure if that is a result of an update in Firefox or SMF?
But then I never used the "Select" feature anyhow..

The bug has been reported here.
Simple Machines Forum Code: [Select] function not working in recent web browsers

It looks like Firefox has added a new feature since 53.
Firefox Release Notes Firefox 53 for developers
Quote
The Selection.setBaseAndExtent() method of the Selection API is now implemented (see bug 1321623).

When you click on [Select] with Firefox, the console says
(By the time of speaking)
IndexSizeError: Index or size is negative or greater than the allowed amount  script.js:1366
   smfSelectText http://forum.tinycorelinux.net/Themes/default/scripts/script.js:1366:4
   onclick http://forum.tinycorelinux.net/index.php/topic,13771.msg133413.html:1:8
[/code]

Due to the new function, SMF uses the Safari code at line: 1363 in file script.js
Code: [Select]
line: 1358 // Firefox at el.
line: 1359 else if (window.getSelection)
line: 1360 {
line: 1361   var oCurSelection = window.getSelection();
line: 1362   // Safari is special!
line: 1363   if (oCurSelection.setBaseAndExtent)
line: 1364   {
line: 1365     var oLastChild = oCodeArea.lastChild;
line: 1366     oCurSelection.setBaseAndExtent(oCodeArea, 0, oLastChild, 'innerText' in oLastChild ? oLastChild.innerText.length : oLastChild.textContent.length);
line: 1367   }
line: 1368   else
line: 1369   {
line: 1370     var curRange = document.createRange();
line: 1371     curRange.selectNodeContents(oCodeArea);
line: 1372
line: 1373     oCurSelection.removeAllRanges();
line: 1374     oCurSelection.addRange(curRange);
line: 1375   }
line: 1376 }

In short:
if (function exist) -> code for Safari
else -> code for the others

There's a workaround that should fix the behavior.

The workaround:
if (function exist && not firefox) -> code for Safari
else -> code for the others

Is there any chance the workaround can be applied ?
Thanks.  :)

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Bug with the forum
« Reply #1 on: September 05, 2017, 01:04:58 AM »
There is an easy workaround, do not use Firefox. FF now is incompatible with many corporate sites, banking applications, etc. which work even with Microsoft browser.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline polikuo

  • Hero Member
  • *****
  • Posts: 739
Re: Bug with the forum
« Reply #2 on: September 05, 2017, 01:46:33 AM »
There is an easy workaround, do not use Firefox. FF now is incompatible with many corporate sites, banking applications, etc. which work even with Microsoft browser.

Or, I could just stick with the older release.

It's just a minor inconvenience, not something horrible enough that would push me away from this browser.

FYI
BrowserWorking
FF-newX
FF-oldV
fifthV
dilloX
EdgeV
Chrome60V
opera-12V

Obviously dillo wouldn't work cause it does not support javascript.
I don't have other browsers for testing.