Skip to content

<Script> tag gets removed #528

Closed
Closed

Description

@chiccorosso

when invoking tidy with a configuration file, no matter what, the <script> tag gets removed:

<script src="filename.js"></script>

or

<script src="filename.js">/* some info */</script>

Version is 5.4.0 on macosx

Activity

  1. chiccorosso commented on Apr 12, 2017

    @chiccorosso
    Author

    Closed. My fault. I apologize.

  2. geoffmcl commented on Apr 12, 2017

    @geoffmcl
    Contributor

    @chiccorosso glad this got closed...

    I had done many tests, and was unable to duplicate...

    No problem... now closed... thanks...

  3. chiccorosso commented on Apr 13, 2017

    @chiccorosso
    Author

    Then I'm uploading this file. As you can see the code is very malformed.

    The code: <SCRIPT src="glb_LInk.js"></SCRIPT>
    Gets removed by tidy because of the A tag with malformed target and onclick attributes.

    I have this script call in hundreds of files and where there is that malformed "A" code it gets removed.

    I can't understand if it's because of the malformed code of because of the fact that the file is utf-16 with no char code specification.

    If you can help in this for sure I'll save a lot of time. If this can help you in improving tidy I'll be very happy for this.

    Here's the file:

    myTEST.zip

  4. chiccorosso commented on Apr 13, 2017

    @chiccorosso
    Author

    Thank you very much for your attention!

  5. geoffmcl commented on Apr 13, 2017

    @geoffmcl
    Contributor

    @chiccorosso sorry you are going to have to explain more exactly what is the problem... and what config are you using, if any...

    When I run tidy 5.5.14 latest, or release 5.4.0, that <script src="glb_LInk.js"></script> is NOT removed?

    Yes, I can see your myTEST.htm file is in UTF-16, with a BOM to indicate that, so tidy inputs it as UTF-16... Tidy does not look for meta charset="???"> tag to set the input encoding, but it does use the BOM...

    Since I added no encoding to the config, tidy complains that the default input encoding (utf-8) does not match the actual (utf-16), as indicated by the BOM -

    line 1 column 1 - Warning: specified input encoding (utf-8) does not match actual input encoding (utf-16)
    

    Again in the absence of a config, tidy used its default of utf-8 for output... the first part of the output is -

    <!DOCTYPE html>
    <html>
    <head>
    <meta name="generator" content=
    "HTML Tidy for HTML5 for Windows version 5.5.14">
    <link href="../STILI.CSS" rel="stylesheet" type="text/css">
    <script src="glb_LInk.js"></script>
    <title></title>
    </head>
    <body class="IndexTop">
    <p class="TitoloIndice">USO DELLA MACCHINA</p>
    <ul>
    <li class="VoceElenco Linked"><a href="Ind_Introduzione.htm"
    target="Dn_right" onclick=
    "parent.frames[1].location.href=&quot;Pag_Pulsantiera.htm&quot;">INTRODUZIONE</a></li>
    <li class="VoceElenco Linked">
    <script language="JavaScript">
               glb_1_PageLinkOnClick("Ind_Navigazione.htm","NAVIGAZIONE","Dn_right","Pag_glbHMI_Uso_pulsanti.htm");        
    </script></li>
    <li class="VoceElenco Linked">
    <script language="JavaScript">
               glb_1_PageLinkOnClick("Ind_Dati_visibili.htm","DATI SEMPRE VISIBILI","Dn_right","Pag_glbHMI_Banner_allarmi.htm");        
    </script></li>
    ... and so on

    And except for the tidy mark, the output of tidy version 5.4.0 is exactly the same...

    Yes, tidy does complain that the <a> contains unexpected or duplicate quote marks, but seems to fix the <a> tags, and converts the unexpected " to &quot;, which again looks fine... and it corrects the malformed target and onclick attributes...

    What is wrong here? It seems all script tags have been maintained, or am I missing something very obvious?

    Maybe I do not understand... please try to explain more exactly what problem you see... thanks...

  6. added this to the 5.5 milestone on Apr 13, 2017
  7. geoffmcl commented on Nov 30, 2017

    @geoffmcl
    Contributor

    No comments in a long, long time...

    Maybe it solved itself ;=)), so closing this...

    Feel free to re-open, or file a new issue... thanks...

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions