question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Html script closing-tag not detected when occurs immediately after 2 slashes

See original GitHub issue

Hi, I found a bug, with the html grammar in VS Code, when you place a closing script-tag in the same line immediately after 2 fwd slashes, as: <script> //</script> the grammar will not detect the closing tag, and will display it with wrong color, see images.

(I’m not sure if the issue is related only to vscode-textmate, or it belongs to textmate/html.tmbundle).

VS Code: sample

Visual Studio 2015: capture


  • VSCode Version: Code 1.13.1 (379d2efb5539b09112c793d3d9a413017d736f89, 2017-06-14T18:21:47.485Z)
  • OS Version: Windows_NT ia32 10.0.15063

Steps to Reproduce:

  1. Open any html document with VSCode.
  2. Insert a script element in the document, and place the script’s closing-tag immediately after 2 fwd slashes.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
alexdimacommented, Aug 23, 2017

I think this is not a vscode-textmate issue. The problem here is that the html grammar includes source.js which is HTML agnostic and “eats up” all characters of a line comment to the end of the line for example. IMHO we would need to have a special source.html-embedded.js or something which is always looking for </script>. AFAIK there are no other workarounds for an embedded TM grammar.

0reactions
alexdimacommented, Apr 4, 2019

Thank you @msftrncs , this issue is also fixed by #85

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why don't self-closing script elements work? - Stack Overflow
And in plain HTML, the self-closing syntax is not supported. The trailing slash is just ignored, you have to use an explicit closing...
Read more >
Closing an HTML element without using literal slashes?
The problem is that the <script> tag can't be closed because the filename can't contain a / . This means that the script...
Read more >
Invalid XHTML: missing trailing slashes, absolute urls ... - Drupal
So far I've found that var $content = $('<div>' + content + '</div>'); // No .outerHTML() in jQuery :( is where the self...
Read more >
To slash or not to slash | Google Search Central Blog
Historically, it's common for URLs with a trailing slash to indicate a directory, and those without a trailing slash to denote a file:....
Read more >
XSS Filter Evasion - OWASP Cheat Sheet Series
The following is a "polygot test XSS payload." This test will execute in multiple contexts including html, script string, js and URL.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found