Menu

#90 Renderer class picks out content from within a script tag

General
open-fixed
nobody
None
5
2020-07-24
2020-07-16
No

Hi
The Renderer class seems to be returning content which is inside a script tag.
If you take a look at the attached test class, you can see that the returned Renderer.toString() content contains non visible text which is part of a script tag.

If you take a look at the HTML string constant in the code, line 16 seems to cause the issue. If you remove this, the issue goes away.
Let me know if you need any further info.

Thanks

Danny

1 Attachments

Discussion

  • Martin Jericho

    Martin Jericho - 2020-07-18
    • status: unread --> open-fixed
     
  • Martin Jericho

    Martin Jericho - 2020-07-18

    Thanks for the bug report!

    Fixed in version 3.5.

    Although the parser was already designed to ignore other tags inside SCRIPT elements, there was a bug triggered by the presence of server tags inside the script element. In your example it was the <%- data.price %> tag causing the problem.

    Until version 3.5 is officially released, the development version is available here:
    http://jericho.htmlparser.net/temp/jericho-html-3.5-dev.zip

    Although it has been 5 years since the last official release, version 3.5 includes a new major feature that requires significant time to document, and I don't envisage having spare time in the foreseeable future. So the official 3.5 release may still be some time away.

     
  • Daniel Gonzalez

    Daniel Gonzalez - 2020-07-24

    Thanks for the fix.

    Danny

     

Log in to post a comment.