Diffdown is a real-time collaborative Markdown editor/previewer built on the AT Protocol diffdown.com
at 87b736ef368a36cd6d4ebbcb18d2b4b30dc67f6d 69 lines 1.5 kB view raw
1# Doesn't parse VB as JS 2 3<script type="text/visualbasic">let something = 20</script> 4 5==> 6 7Document(Element(OpenTag(StartTag,TagName,Attribute(AttributeName,Is,AttributeValue),EndTag), 8 ScriptText, 9CloseTag(StartCloseTag,TagName,EndTag))) 10 11# Does parse type-less script tags as JS 12 13<script>/foo/</script> 14 15==> 16 17Document(Element(OpenTag(StartTag,TagName,EndTag), 18 Script(ExpressionStatement(RegExp)), 19CloseTag(StartCloseTag,TagName,EndTag))) 20 21# Still doesn't end script tags on closing tags 22 23<script type=something></foo></script> 24 25==> 26 27Document(Element(OpenTag(StartTag,TagName,Attribute(AttributeName,Is,UnquotedAttributeValue),EndTag), 28 ScriptText, 29CloseTag(StartCloseTag,TagName,EndTag))) 30 31# Missing end tag 32 33<html><script>null 34 35==> 36 37Document(Element(OpenTag(StartTag,TagName,EndTag), 38 Element(OpenTag(StartTag,TagName,EndTag), 39 Script(ExpressionStatement(null))))) 40 41# JS with script type 42 43<script type="text/javascript">console.log(2)</script> 44 45==> 46 47Document(Element(OpenTag(StartTag,TagName,Attribute(AttributeName,Is,AttributeValue),EndTag), 48 Script(...), 49CloseTag(StartCloseTag,TagName,EndTag))) 50 51# JS with unquoted script type 52 53<script type=module>console.log(2)</script> 54 55==> 56 57Document(Element(OpenTag(StartTag,TagName,Attribute(AttributeName,Is,UnquotedAttributeValue),EndTag), 58 Script(...), 59CloseTag(StartCloseTag,TagName,EndTag))) 60 61# Error in JS 62 63<script>a b</script> 64 65==> 66 67Document(Element(OpenTag(StartTag,TagName,EndTag), 68 Script(...), 69CloseTag(StartCloseTag,TagName,EndTag)))