You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
"type" attribute of "script" tag being ignored #223
It seems the type attribute of the script tag isn't being properly checked in the latest version of Atom, resulting in the body of all script tags, regardless of type, being syntactically highlighted as JavaScript.
Steps to Reproduce
Open new file
Paste the following:
<script type="text/html">
<p>This is highlighted as having errors</p>
console.log('This is highlighted as being JS');
</script>
Switch language to HTML
Expected behavior: The body of the script tag should be highlighted as HTML, i.e. white carets with red p's on the <p>...</p> tag and all white on the console.log(...); line.
Actual behavior: The body of the script tag is highlighted as JavaScript, with teal carets on the aforementioned tag carets and proper JS highlighting on the console.log(...) line.
Looks like if that snippet is put in some minimal HTML e.g.:
<!DOCTYPE html><html><body><scripttype="text/html"><p>This is highlighted as having errors</p>console.log('This is highlighted as being JS');</script></body></html>
Then I can reproduce initially, but after saving as a .html file and reopening, it works ok. If the code snippet is in a .html file on its own, then I see the issue there as well.
Doesn't reproduce with Tree-sitter disabled though.
Reproduces how often: Always
Versions
Atom: 1.33.1
APM: 2.1.2
OS: Windows 10 Pro v1803
Additional Information
Any additional information, configuration or data that might be necessary to reproduce the issue.
Thanks for the report - reproduced on 1.33.1 on macOS 10.12.6. Looks like if that snippet is put in some minimal HTML e.g.:
<!DOCTYPE html><html><body><scripttype="text/html"><p>This is highlighted as having errors</p>console.log('This is highlighted as being JS');</script></body></html>
Then I can reproduce initially, but after saving as a .html file and reopening, it works ok. If the code snippet is in a .html file on its own, then I see the issue there as well.
Doesn't reproduce with Tree-sitter disabled though.
Activity
rsese commentedon Dec 27, 2018
Thanks for the report - reproduced on 1.33.1 on macOS 10.12.6. Looks like if that snippet is put in some minimal HTML e.g.:
Then I can reproduce initially, but after saving as a
.htmlfile and reopening, it works ok. If the code snippet is in a.htmlfile on its own, then I see the issue there as well.Doesn't reproduce with Tree-sitter disabled though.
MatthewPinheiro commentedon Jan 25, 2019
An update on this:
In my case, the primary cause of the issue was putting an HTML comment spanning multiple lines at the top of the file, e.g.
The workaround to this was, going off the reply from @rsese , simply putting
<!DOCTYPE html>at the top of the file before the comment.