Ignore script tags in HTML files which are not JavaScript.

This commit is contained in:
Michael Herzberg 2015-06-21 15:22:39 +02:00
parent dbe76a5145
commit 42e5ec14e6
1 changed files with 6 additions and 2 deletions

View File

@ -87,7 +87,9 @@ public class DomLessSourceExtractor extends JSSourceExtractor {
@Override @Override
public void handleEndTag(ITag tag) { public void handleEndTag(ITag tag) {
if (tag.getName().equalsIgnoreCase("script")) { if (tag.getName().equalsIgnoreCase("script")
&& (tag.getAttributeByName("type") == null
|| tag.getAttributeByName("type").fst.equals("text/javascript"))) {
assert currentScriptTag != null; assert currentScriptTag != null;
currentScriptTag = null; currentScriptTag = null;
} else if (currentScriptTag != null && tag.getName().equals("!--")) { } else if (currentScriptTag != null && tag.getName().equals("!--")) {
@ -118,7 +120,9 @@ public class DomLessSourceExtractor extends JSSourceExtractor {
@Override @Override
public void handleStartTag(ITag tag) { public void handleStartTag(ITag tag) {
if (tag.getName().equalsIgnoreCase("script")) { if (tag.getName().equalsIgnoreCase("script")
&& (tag.getAttributeByName("type") == null
|| tag.getAttributeByName("type").fst.equals("text/javascript"))) {
handleScript(tag); handleScript(tag);
assert currentScriptTag == null; assert currentScriptTag == null;
currentScriptTag = tag; currentScriptTag = tag;