#937 Style elements dropped when show-body-only is enabled


Tidy automatically moves <style> elements from body to head; with show-body-only enabled this means that style elements in the body are discarded. This is a serious loss of functionality: while putting style elements in the body is technically invalid HTML, every CSS-aware browser interprets it without fault, and it is widely used when, for some reason, changing the head is not possible (PHP without output buffering, CMS where the user gets full control over the contents of a div etc). There should be either an option to disable moving style elements to the head, or it should be disabled automatically when show-body-only is enabled.

Version: HTML Tidy for Linux released on 25 March 2009


  • Geoff

    Geoff - 2015-12-09

    Thanks for the report... now long ago... sorry for the delay...

    Tidy source has moved to https://github.com/htacg/tidy-html5

    Bugs can only be accepted against the current source, so closing this as out-of-date!

    It would seem head style element is lost when --show-body-only yes, even in modern tidy... but no html sample to quickly try... but it would seem reasonable...

    If you want the body only, then it seems you have no interest in the style of the result... OTOH maybe you want to supply a new style... but then the show of body only is correct, dropping any other style...

    In other words I struggle to find a use case here for such, at this time, Feature Request...

    If there is still an issue here then it should be filed at Issues. And if you find a code fix, in your github fork, then it could be presented as a Pull Request... thanks... tidy needs your support...

  • Geoff

    Geoff - 2015-12-09
    • status: open --> closed-out-of-date
    • Group: --> Current - all platforms

Log in to post a comment.