GithubHelp home page GithubHelp logo

Incorrect processing of <script type="text/html"> about htmlmin HOT 3 CLOSED

roadster31 avatar roadster31 commented on May 27, 2024
Incorrect processing of

Comments (3)

roadster31 avatar roadster31 commented on May 27, 2024

After a few tests, it seems that DOMDocument::loadHTML() is the root cause of this problem. Loading the test document and saving it immediately gives the following result, where </div> are missing :

<!DOCTYPE html>
<?xml encoding="UTF-8" ?><html lang="fr"><head><title>Test</title></head><body>
    A Body

    <script id="elements-image-1" type="text/html">
        <div class="place badge-carte">Place du Village<br>250m - 2mn &agrave; pied
        <div class="telecabine badge-carte">T&eacute;l&eacute;cabine du Chamois<br>250m - 2mn &agrave; pied
        <div class="situation badge-carte"><img src="https://domain.tld/assets/frontOffice/kneiss/template-assets/assets/dist/img/08ecd8a.png" alt="">
    </script></body></html>

I'll investigate and get back to you if I find something interesting about that.

from htmlmin.

roadster31 avatar roadster31 commented on May 27, 2024

After digging in StackOverflow, it seems that the only possible solution is parsing the HTML as XML, after processing self-closing tags to provide a valid XML document to the XML loader :

https://stackoverflow.com/questions/19788017/how-to-combine-phps-domdocument-with-a-javascript-template

from htmlmin.

voku avatar voku commented on May 27, 2024

fixed in version 3.1.3

from htmlmin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.