Javascript 代码块在mozilla firefox中工作,但在Chrome中不工作

Javascript 代码块在mozilla firefox中工作,但在Chrome中不工作,javascript,node.js,google-chrome,firefox,Javascript,Node.js,Google Chrome,Firefox,有人知道为什么这个代码块可以在Mozilla中完美地工作,而在Chrome中却完全不工作吗?这个代码块在Mozilla Firefox中生成和呈现得非常完美,但在Chrome搜索引擎中却完全没有。当我将一些新代码放入从x=-1变量及其以下开始的块中时,这就开始了 function displaySideBarLink( title, sectionname, anchorid) { let sidebar; if ($) { sidebar = $('#pag

有人知道为什么这个代码块可以在Mozilla中完美地工作,而在Chrome中却完全不工作吗?这个代码块在Mozilla Firefox中生成和呈现得非常完美,但在Chrome搜索引擎中却完全没有。当我将一些新代码放入从x=-1变量及其以下开始的块中时,这就开始了

function displaySideBarLink( title, sectionname, anchorid) {

    let sidebar;

    if ($) {
        sidebar = $('#page-layout #record-sidebar .w3-container.menu-links');
    }

    if (sidebar) {
        // Create a link in the side bar navigation
        let sidebar_link = document.createElement("a");


        let section_title = title || sectionname;
        if (section_title) {
            sidebar_link.id = sectionname + "-sidebar";
            sidebar_link.className = "w3-bar-item";
            sidebar_link.href = '#' + anchorid;

            sidebar_link.title = section_title;
            sidebar_link.alt = section_title;
            sidebar_link.innerText = section_title;


            sidebar.append(sidebar_link);
        }

    }

    x = -1
    lastName = ""
    $("#panels-region .panel-heading").each(function () {
        x++
        console.log($(this))
        curName = $(this).attr("name")
        $('<a id="panels-sidebar-' + curName.replace(/ |\//g, "_") + '" class="w3-bar-item" href="#panel-' + x + '-header" title="' + curName.replace(/ |\//g, "_") + '">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' + curName + '</a>').insertAfter("#panels-sidebar" + lastName.replace(/ |\//g, "_"))
        console.log($(this).attr("name"), lastName)
        lastName = "-" + curName
    })
    lastName = ""
    $("#graph-region .panel-heading h4").each(function () {
        try {
            x++
            console.log($(this).text())
            curName = $(this).text().replace("Collapse panelExpand panel", "")
            $('<a id="tree_viewers-sidebar-' + curName.replace(/ |\//g, "_") + '" class="w3-bar-item" href="#panel-' + x + '-header" title="' + curName.replace(/ |\//g, "_") + '">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' + curName + '</a>').insertAfter("#tree_viewers-sidebar" + lastName.replace(/ |\//g, "_"))
            console.log($(this).attr("name"), lastName)
            lastName = "-" + curName
        } catch (e) {
        }
    })

    $(".menu-links a").css("padding", "0px 8px")

    $(".field-value").each(function () {
        $(this).html($(this).text())
    })
    $("#tables-content td").each(function () {
        $(this).html($(this).text())
    })
    $(".panel-body").css("background-color", "white")
    $("#panels-region .panel-wrapper .panel-default").css("background-color", "white")
}
功能显示侧栏链接(标题、节名、锚点){
让边栏;
如果(美元){
边栏=$(“#页面布局#记录边栏.w3容器.菜单链接”);
}
如果(侧栏){
//在侧栏导航中创建链接
让边栏链接=document.createElement(“a”);
让section_title=title | | sectionname;
if(章节标题){
sidebar_link.id=sectionname+“-sidebar”;
侧边栏_link.className=“w3栏项目”;
侧边栏_link.href='#'+anchorid;
边栏链接标题=章节标题;
sidebar_link.alt=章节标题;
侧边栏链接.innerText=章节标题;
附加(侧栏链接);
}
}
x=-1
lastName=“”
$(“#panels region.panel heading”)。每个(函数(){
x++
console.log($(this))
curName=$(this.attr(“名称”)
$(“”).insertAfter(“#panels侧栏”+lastName.replace(//124; \//g,”))
console.log($(this.attr(“name”),lastName)
lastName=“-”+curName
})
lastName=“”
$(“#图形区域.面板标题h4”)。每个(函数(){
试一试{
x++
console.log($(this.text())
curName=$(this).text().replace(“折叠面板展开面板”,”)
$(“”).insertAfter(“#tree\u viewers-sidebar”+lastName.replace(//124; \//g,“"”))
console.log($(this.attr(“name”),lastName)
lastName=“-”+curName
}捕获(e){
}
})
$(“.menu links a”).css(“填充”,“0px 8px”)
$(“.field value”)。每个(函数(){
$(this.html($(this.text())
})
$(“#表内容td”)。每个(函数(){
$(this.html($(this.text())
})
$(“.panel body”).css(“背景色”、“白色”)
$(“#panels region.panel wrapper.panel default”).css(“背景色”、“白色”)
}
函数getRecordUI(别名、类型、id、视图类型、版本){
//从数据模型注册表获取记录模型
如果(类型){
getJSONUIModel(类型,
功能(数据){
displayRecordSections(别名、类型、id、版本、视图类型、数据);
},
函数(错误){
log(“获取类型“+类型的UI模型时出错”);
console.log(错误);
displayRecordSections(别名、类型、id、版本、视图类型、null);
});
}否则{
displayRecordSections(别名、类型、id、版本、视图类型、null);
}
设x=-1;
lastName=“”;
$(“#panels region.panel heading”)。每个(函数(){
x++
console.log($(this))
让curName=$(this.attr(“name”)
$(“”).insertAfter(“#panels侧栏”+lastName.replace(//124; \//g,”))
console.log($(this.attr(“name”),lastName)
lastName=“-”+curName
})
$(“#图形区域.面板标题h4”)。每个(函数(){
x++
设x=-1;
console.log($(this.text())
让curName=$(this.text().replace(“折叠面板展开面板”,”)
$(“”).insertAfter(“#tree\u viewers-sidebar”+lastName.replace(//124; \//g,“"”))
console.log($(this.attr(“name”),lastName)
lastName=“-”+curName
})
$(“.menu links a”).css(“填充”,“0px 8px”)
$(“.panel body”).css(“背景色”、“白色”)
$(“#panels region.panel wrapper.panel default”).css(“背景色”、“白色”)
}

“Chrome搜索引擎”?那么开发者控制台中是否有错误?是否执行任何控制台行?加载资源失败:服务器以404(未找到)视图的状态响应。js:60获取用户权限失败,url=/query/web/api/v1/userUncaught TypeError:this.getPermissions不是对象上的函数。(views.js:63)在Object.fireWith[as rejectWith](jquery.js:3211)在XMLHttpRequest(jquery.js:8266)处着火(jquery.js:3099)。(jquery.js:8605)jquery.js:8561[Deprecation]主线程上的同步XMLHttpRequest已被弃用,因为它会对最终用户的体验产生有害影响。如需更多帮助,请查看。send@jquery.js:8561 undefined.svg:1加载资源失败:服务器响应状态为404(未找到)
function getRecordUI( alias, type, id, viewtype, version ) {

    // Get record model from Data Model Registry
    if ( type ) {
        getJSONUIModel( type,
            function ( data ) {
                displayRecordSections( alias, type, id, version, viewtype, data );
            },
            function (error) {
                console.log("Error getting UI model for type " + type);
                console.log(error);
                displayRecordSections( alias, type, id, version, viewtype, null );
            });
    } else {
        displayRecordSections( alias, type, id, version, viewtype, null );
    }
    let x = -1;
    lastName = "";
    $("#panels-region .panel-heading").each(function () {
        x++

        console.log($(this))
        let curName = $(this).attr("name")
        $('<a id="panels-sidebar-' + curName.replace(/ |\//g, "_") + '" class="w3-bar-item" href="#panel-' + x + '-header" title="' + curName.replace(/ |\//g, "_") + '">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' + curName + '</a>').insertAfter("#panels-sidebar" + lastName.replace(/ |\//g, "_"))
        console.log($(this).attr("name"), lastName)
        lastName = "-" + curName
    })

    $("#graph-region .panel-heading h4").each(function () {
        x++
        let x = -1;
        console.log($(this).text())
        let curName = $(this).text().replace("Collapse panelExpand panel", "")
        $('<a id="tree_viewers-sidebar-' + curName.replace(/ |\//g, "_") + '" class="w3-bar-item" href="#panel-' + x + '-header" title="' + curName.replace(/ |\//g, "_") + '">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' + curName + '</a>').insertAfter("#tree_viewers-sidebar" + lastName.replace(/ |\//g, "_"))
        console.log($(this).attr("name"), lastName)
        lastName = "-" + curName
    })

    $(".menu-links a").css("padding", "0px 8px")
    $(".panel-body").css("background-color", "white")
    $("#panels-region .panel-wrapper .panel-default").css("background-color", "white")

}