Ignore:
Timestamp:
2023-07-06T19:25:53+12:00 (11 months ago)
Author:
anupama
Message:

The double questionmark (with assignment) javascript operator called nullish coalescing (with assignment) operator, which tests if a variable is null or undefined and if so assigns the value after the equals sign, does not work in older versions of safari and firefox such as the old firefox on the 32 bit linux VM. As a result, expanding document nodes and viewing a document section found through a search result takes forever to load. Dr Bainbridge was correct that the JavaScript was generated by GS3 Java runtime source code, not XSLT code in web/interfaces. This commit modifies the code to use the basic equivalent JavaScript syntax instead for the double questionmark with assignment operator.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/XSLTUtil.java

    r37545 r37804  
    936936    )
    937937    {
    938         if (!isRootObject) {
    939             buffer.append(objectPath + "??={};\n");
    940             return;
    941         }
     938
     939        // the ?? isn't supported in some older versions of safari and firefox (as run on 32 bit linux test machine)
     940       
     941        //if (!isRootObject) {
     942        ////buffer.append(objectPath + "??={};\n");
     943        // Nullish coalescing operator https://plainenglish.io/blog/javascript-operator
     944        // Nullish coalescing operator with assignment https://stackoverflow.com/questions/71238309/what-is-double-question-mark-equal
     945        //buffer.append("if ("+objectPath+" == null || "+objectPath+" == undefined) {"+objectPath+"={};}\n"); // untested
     946        //return;
     947        //}
     948       
    942949
    943950        buffer.append("if(typeof " + objectPath + "===\"undefined\"){" + objectPath + "={};}\n");
Note: See TracChangeset for help on using the changeset viewer.