has a string like this: var innerHTML = "SRC_BANK_ (select SERNO, MODEL_ID, ITEM_ID, INIT_VALUE, RE_VALUE, FIN_VALUE, GUARANTY_NO from CMIS.psp_check_info) < MainJob >"
convert it in two different ways: (the following code can be copied and run in the browser console)
//html:htmltypesecape
function escapeHtml(html,type,escape){
var objE = document.createElement("div");
objE.innerHTML = html;
type
? (escape
? (html.includes("&") ? (objE.innerText = html) : (objE.innerText = new Option(html).innerHTML))
: (html.includes("<") && (objE.innerText = html)))
: (objE.innerHTML = objE.innerText);
return objE.innerText;
}
var innerHTML = "SRC_BANK_( select SERNO ,MODEL_ID ,ITEM_ID ,INIT_VALUE ,RE_VALUE ,FIN_VALUE ,GUARANTY_NO from CMIS.psp_check_info)<MainJob>";
var nodeId0 = innerHTML.replace(/</,"<").replace(/>/,">").replace(//g," ");
var nodeId1 = escapeHtml(innerHTML,true);
console.log(nodeId0 == nodeId1);
console.log("nodeId0:",nodeId0,nodeId0.length);
console.log("nodeId1:",nodeId1,nodeId1.length);
however, the result is
which boss can explain why they are not equal?