The script tag is greyed out in firefox and the debugger denies the existance of such script.js on localhost site [closed]

20 hours ago 1
ARTICLE AD BOX

script.js is a real script, and if I run the program on codespaces, it works, but not on a localhost site, and yet, it doesn't work. There is no sign of struggle and there are no errors. The network tab gives a 200 request to script.js, and if I do localhost:80/script.js, it shows the script.

But, the script tag is greyed out on firefox's code editor.

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <input type="text" id="in"> <button id ="evalBtn">evaluate</button> <script type="text/javascript" src="script.js" charset="UTF-8" defer/> </body> </html>

When evalBtn is clicked, the following javascript code should run.

document.getElementById("evalBtn").addEventListener("click", () => { console.log(tokenise(document.getElementById("in").value)) })

And yes, I know that tokenise is fine, but if you really want to know, it's const tokenise=(expr)=>{ let operands=("'+10↓⊼"+prenots+ands).split("").concat(xors).concat(imps).concat(pmis).map((a)=>a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'));//the map escapes return expr.split(RegExp("("+operands.join("|")+")/u")) And yes, David, with the comment "Cast a vote for the wrong reason, my apologies. Looks like a duplicate: Why don't self-closing script elements work?", which is either the most helpful or mort unhelpful (type of) comment(in this case being the most helpful), fixed it, as the moment it stopped being self-closing, it worked.

Also, since someone complained about intended behaviour, let's say, I put a&b in the box and press evaluate, I get ["a","&","b"]. You can put more complex things if you want.

Read Entire Article