mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
don't check script inside true html files
#WEB-9833 fixed
This commit is contained in:
+2
@@ -55,6 +55,8 @@ public class CheckValidXmlInScriptBodyInspectionBase extends XmlSuppressableInsp
|
||||
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
|
||||
return new XmlElementVisitor() {
|
||||
@Override public void visitXmlTag(final XmlTag tag) {
|
||||
if (HtmlUtil.isHtmlTag(tag)) return;
|
||||
|
||||
if (SCRIPT_TAG_NAME.equals(tag.getName()) ||
|
||||
tag instanceof HtmlTag && SCRIPT_TAG_NAME.equalsIgnoreCase(tag.getName())) {
|
||||
final PsiFile psiFile = tag.getContainingFile();
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.intellij.xml.util;
|
||||
|
||||
import com.intellij.codeInspection.InspectionProfile;
|
||||
import com.intellij.codeInspection.htmlInspections.XmlEntitiesInspection;
|
||||
import com.intellij.html.RelaxedHtmlNSDescriptor;
|
||||
import com.intellij.ide.highlighter.HtmlFileType;
|
||||
import com.intellij.ide.highlighter.XHtmlFileType;
|
||||
import com.intellij.javaee.ExternalResourceManagerEx;
|
||||
@@ -397,6 +398,12 @@ public class HtmlUtil {
|
||||
return isHtml5Document(doc);
|
||||
}
|
||||
|
||||
public static boolean isHtmlTag(XmlTag tag) {
|
||||
final XmlElementDescriptor descriptor = tag.getDescriptor();
|
||||
return descriptor != null && descriptor.getNSDescriptor() instanceof RelaxedHtmlNSDescriptor &&
|
||||
tag.getLanguage() != XHTMLLanguage.INSTANCE;
|
||||
}
|
||||
|
||||
public static boolean hasNonHtml5Doctype(XmlElement context) {
|
||||
XmlDocument doc = PsiTreeUtil.getParentOfType(context, XmlDocument.class);
|
||||
if (doc == null) {
|
||||
|
||||
Reference in New Issue
Block a user