Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<Script> tag gets removed #528

Closed
chiccorosso opened this issue Apr 11, 2017 · 6 comments
Closed

<Script> tag gets removed #528

chiccorosso opened this issue Apr 11, 2017 · 6 comments

Comments

@chiccorosso
Copy link

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

@chiccorosso
Copy link
Author

Closed. My fault. I apologize.

@geoffmcl
Copy link
Contributor

@chiccorosso glad this got closed...

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

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

@chiccorosso
Copy link
Author

chiccorosso commented Apr 13, 2017

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

@chiccorosso chiccorosso reopened this Apr 13, 2017
@chiccorosso
Copy link
Author

Thank you very much for your attention!

@geoffmcl
Copy link
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...

@geoffmcl geoffmcl added this to the 5.5 milestone Apr 13, 2017
@geoffmcl
Copy link
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
Projects
None yet
Development

No branches or pull requests

2 participants