Tiny Core Linux

General TC => General TC Talk => Topic started by: polikuo on September 04, 2017, 08:10:08 PM

Title: Bug with the forum
Post by: polikuo on September 04, 2017, 08:10:08 PM
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 (https://www.simplemachines.org/community/index.php?topic=553445.0)

It looks like Firefox has added a new feature since 53.
Firefox Release Notes Firefox 53 for developers (https://developer.mozilla.org/en-US/Firefox/Releases/53)
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 (https://www.simplemachines.org/community/index.php?P=e3db12dcd1d80c45ce01e9511d20f817&topic=553445.msg3924246#msg3924246) 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.  :)
Title: Re: Bug with the forum
Post by: bmarkus on September 04, 2017, 09:04:58 PM
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.
Title: Re: Bug with the forum
Post by: polikuo on September 04, 2017, 09:46:33 PM
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.