Skip to content

Instantly share code, notes, and snippets.

@tralamazza
Created October 16, 2012 13:13
Show Gist options
  • Save tralamazza/3899198 to your computer and use it in GitHub Desktop.
Save tralamazza/3899198 to your computer and use it in GitHub Desktop.
htmlparser2 script block parsing
<html>
  <body>
    <script type="text/javascript">
      if (foo<=bar)
        console.log('oh noes');
    </script>
  </body>
</html>

Works.

<html>
  <body>
    <SCRIPT type="text/javascript">
      if (foo<=bar)
        console.log('oh noes');
    </script>
  </body>
</html>

Parses =bar) as a tag (emits opentag/closetag).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment