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

'Head script disabled' shows error if <script> tag is outside of the <body> tag #10

Closed
danielppereira opened this issue Jun 9, 2014 · 5 comments

Comments

@danielppereira
Copy link

I have some .PHP files that have <script>tags that, doesn't have a <head> or <body> tag, because they are just included in another .PHP file. So, when i run the task 'htmlhint' with the option 'Head script disabled' activate, it shows some errors, because it dont find these mentioned tags. But actually, this is not an error. The error must be showed only if there is a <script>tag inside the tag <head>. Please, include an option to ignore it if no tag is founded.

P.S.: (Sorry about the english=))

@branneman
Copy link

Do you have <?php /* some code */ ?> inside your files? It only supports html, not php.

Also, it only supports fully correct html files, not partials. That's why I issued this feature request: #9

@danielppereira
Copy link
Author

Yes, i'm using the htmlhint plugin with .PHP files, and it's working perfectly. The HTML blocks are outside the PHP tags (<?php /* some code */ ?>). Just the rule 'Head script disabled' isn't working well, because it's searching for a <body> that isn't there. This one is in another file, something like a masterpage, that add the other one with <?php require ....

The point is, if a <script> tag is founded, but a <body> tag isn't, then the message below don't have to be displayed:

The script tag can not be used in head.

@branneman
Copy link

I think it's a miracle that that actually works, and it's unintended use.

Also - you can't really use all the rules that way, right? Like the doctype-first rule.

@danielppereira
Copy link
Author

Yes, don't make sense to use the rule you mentioned, in PHP project, because not all files have a doctype.

I had to exclude this rule from my .htmlrintrc file, but with this rule i agree.

@yaniswang
Copy link
Contributor

HTMLHint can't scan template file, or php file.

For example:

<%if%>
<div id="1">
<%else>
<div id="2">
<%end%>
</div>

HTMLHint will report tag-pair error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants