diff --git a/xml/impl/src/com/intellij/xml/util/documentation/HtmlDocumentationProvider.java b/xml/impl/src/com/intellij/xml/util/documentation/HtmlDocumentationProvider.java
index ca275b0dccf6..e1966696370b 100644
--- a/xml/impl/src/com/intellij/xml/util/documentation/HtmlDocumentationProvider.java
+++ b/xml/impl/src/com/intellij/xml/util/documentation/HtmlDocumentationProvider.java
@@ -1,6 +1,8 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.xml.util.documentation;
+import com.intellij.documentation.mdn.MdnApiNamespace;
+import com.intellij.documentation.mdn.MdnDocumentationKt;
import com.intellij.documentation.mdn.MdnSymbolDocumentation;
import com.intellij.lang.Language;
import com.intellij.lang.LanguageDocumentation;
@@ -127,9 +129,10 @@ public class HtmlDocumentationProvider implements DocumentationProvider {
private static boolean checkProvider(@Nullable DocumentationProvider provider) {
if (provider == null) return false;
if (provider instanceof CompositeDocumentationProvider
- && ContainerUtil.or(((CompositeDocumentationProvider)provider).getAllProviders(), p -> p instanceof HtmlDocumentationProvider)) {
+ && ContainerUtil.or(((CompositeDocumentationProvider)provider).getAllProviders(), p -> p instanceof HtmlDocumentationProvider)) {
Logger.getInstance(HtmlDocumentationProvider.class)
- .error("An 'HtmlDocumentationProvider' is most likely registered through 'com.intellij.documentationProvider' extension point instead of 'com.intellij.lang.documentationProvider'. Recurrent behaviour has been prevented.");
+ .error(
+ "An 'HtmlDocumentationProvider' is most likely registered through 'com.intellij.documentationProvider' extension point instead of 'com.intellij.lang.documentationProvider'. Recurrent behaviour has been prevented.");
return false;
}
return true;
@@ -185,15 +188,6 @@ public class HtmlDocumentationProvider implements DocumentationProvider {
return result;
}
- private static HtmlAttributeDescriptor getDescriptor(String name, XmlTag context) {
- HtmlAttributeDescriptor attributeDescriptor = HtmlDescriptorsTable.getAttributeDescriptor(name);
- if (attributeDescriptor instanceof CompositeAttributeTagDescriptor) {
- return ((CompositeAttributeTagDescriptor)attributeDescriptor).findHtmlAttributeInContext(context);
- }
-
- return attributeDescriptor;
- }
-
@Nls
private String generateDocForHtml(PsiElement element, PsiElement originalElement) {
MdnSymbolDocumentation documentation = getDocumentation(element, originalElement);
@@ -215,9 +209,12 @@ public class HtmlDocumentationProvider implements DocumentationProvider {
return null;
}
String key = StringUtil.toLowerCase(text);
- final HtmlTagDescriptor descriptor = HtmlDescriptorsTable.getTagDescriptor(key);
+ final boolean isStdTag = key != null
+ && (MdnDocumentationKt.getHtmlMdnTagDocumentation(MdnApiNamespace.Html, key) != null
+ || MdnDocumentationKt.getHtmlMdnTagDocumentation(MdnApiNamespace.Svg, key) != null
+ || MdnDocumentationKt.getHtmlMdnTagDocumentation(MdnApiNamespace.MathML, key) != null);
- if (descriptor != null && !isAttributeContext(context)) {
+ if (isStdTag && !isAttributeContext(context)) {
try {
final XmlTag tagFromText =
XmlElementFactory.getInstance(psiManager.getProject()).createTagFromText("<" + key + " xmlns=\"" + XmlUtil.XHTML_URI + "\"/>");
@@ -228,9 +225,7 @@ public class HtmlDocumentationProvider implements DocumentationProvider {
}
else {
XmlTag tagContext = findTagContext(context);
- HtmlAttributeDescriptor myAttributeDescriptor = getDescriptor(key, tagContext);
-
- if (myAttributeDescriptor != null && tagContext != null) {
+ if (tagContext != null) {
XmlElementDescriptor tagDescriptor = tagContext.getDescriptor();
return tagDescriptor != null ? tagDescriptor.getAttributeDescriptor(text, tagContext) : null;
}
diff --git a/xml/impl/src/com/intellij/xml/util/documentation/XmlDocumentationProvider.java b/xml/impl/src/com/intellij/xml/util/documentation/XmlDocumentationProvider.java
index 32723bdf3693..5c87a3871564 100644
--- a/xml/impl/src/com/intellij/xml/util/documentation/XmlDocumentationProvider.java
+++ b/xml/impl/src/com/intellij/xml/util/documentation/XmlDocumentationProvider.java
@@ -1,6 +1,7 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.xml.util.documentation;
+import com.intellij.documentation.mdn.MdnDocumentationKt;
import com.intellij.lang.Language;
import com.intellij.lang.documentation.DocumentationProvider;
import com.intellij.lang.documentation.DocumentationUtil;
@@ -40,7 +41,6 @@ public class XmlDocumentationProvider implements DocumentationProvider {
private static final Logger LOG = Logger.getInstance(XmlDocumentationProvider.class);
@NonNls private static final String NAME_ATTR_NAME = "name";
- @NonNls private static final String BASE_SITEPOINT_URL = "http://reference.sitepoint.com/html/";
@Override
@@ -289,13 +289,11 @@ public class XmlDocumentationProvider implements DocumentationProvider {
append = language == XHTMLLanguage.INSTANCE;
}
- if (tag != null) {
- EntityDescriptor descriptor = HtmlDescriptorsTable.getTagDescriptor(tag.getName());
- if (descriptor != null && append) {
+ if (tag != null && append) {
+ var documentation = MdnDocumentationKt.getHtmlMdnDocumentation(tag, tag);
+ if (documentation != null && documentation.getUrl() != null) {
buf.append("
");
- buf.append(XmlBundle.message("html.quickdoc.additional.template",
- descriptor.getHelpRef(),
- BASE_SITEPOINT_URL + tag.getName()));
+ buf.append(XmlBundle.message("html.quickdoc.additional.template", documentation.getUrl()));
}
}
}
diff --git a/xml/openapi/resources/messages/XmlBundle.properties b/xml/openapi/resources/messages/XmlBundle.properties
index b75bbda1f569..63a7946774f4 100644
--- a/xml/openapi/resources/messages/XmlBundle.properties
+++ b/xml/openapi/resources/messages/XmlBundle.properties
@@ -36,7 +36,7 @@ html.inspections.check.empty.tag=Empty tag
html.inspections.check.valid.script.tag=Malformed content of 'script' tag
html.related.linked.files.group=Linked Files
-html.quickdoc.additional.template=More info on W3C website, SitePoint Reference website.
+html.quickdoc.additional.template=More info on MDN website.
web.editor.configuration.title=HTML/CSS
diff --git a/xml/tests/src/com/intellij/html/Html5TagAndAttributeNamesProviderTest.kt b/xml/tests/src/com/intellij/html/Html5TagAndAttributeNamesProviderTest.kt
new file mode 100644
index 000000000000..d8f8d73ef3f7
--- /dev/null
+++ b/xml/tests/src/com/intellij/html/Html5TagAndAttributeNamesProviderTest.kt
@@ -0,0 +1,280 @@
+// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
+package com.intellij.html
+
+import com.intellij.lang.html.HTMLLanguage
+import com.intellij.openapi.util.io.FileUtil
+import com.intellij.openapi.vfs.VfsUtil
+import com.intellij.psi.PsiFileFactory
+import com.intellij.psi.PsiManager
+import com.intellij.psi.impl.source.html.HtmlFileImpl
+import com.intellij.psi.util.siblings
+import com.intellij.psi.xml.XmlFile
+import com.intellij.psi.xml.XmlTag
+import com.intellij.rt.execution.junit.FileComparisonFailure
+import com.intellij.testFramework.PlatformTestUtil
+import com.intellij.testFramework.fixtures.BasePlatformTestCase
+import com.intellij.util.asSafely
+import com.intellij.xml.Html5SchemaProvider
+import java.io.File
+import java.io.FileNotFoundException
+
+class Html5TagAndAttributeNamesProviderTest : BasePlatformTestCase() {
+
+ fun testHtml5TagAndAttributeNamesProvider() {
+ val location = PlatformTestUtil.getCommunityPath().replace(File.separatorChar, '/') +
+ "/xml/xml-psi-impl/gen/com/intellij/xml/util/Html5TagAndAttributeNamesProvider.kt"
+ val contents = FileUtil.loadFile(File(location), "UTF-8", false)
+ val version = Regex("VERSION = ([0-9]+)").find(contents)?.groups?.get(1)?.value?.toIntOrNull() ?: 0
+ val expectedContents = generateFile(version)
+ if (expectedContents != contents) {
+ throw FileComparisonFailure(
+ "Looks like HTML5 schema was updated, so Html5TagAndAttributeNamesProvider needs to be updated as well. Copy version change!!!",
+ contents, generateFile(version + 1), location)
+ }
+ }
+
+ private fun generateFile(version: Int): String {
+ val location = Html5SchemaProvider.getHtml5SchemaLocation()
+
+ val descriptor = (PsiManager.getInstance(project).findFile(
+ VfsUtil.findFileByIoFile(File(location), true)
+ ?: throw FileNotFoundException(location)
+ ) as XmlFile).document!!.metaData as RelaxedHtmlNSDescriptor
+
+ val htmlTags = descriptor.getRootElementsDescriptors(null)
+
+ val htmlFile = PsiFileFactory.getInstance(project).createFileFromText(
+ "test.html", HTMLLanguage.INSTANCE, "") as HtmlFileImpl
+
+ val svg = htmlFile.document?.rootTag?.asSafely()!!
+ val math = svg.siblings(withSelf = false).firstNotNullOf { it as? XmlTag }
+ val map = sequenceOf("HTML" to htmlTags,
+ "SVG" to svg.descriptor!!.getElementsDescriptors(svg),
+ "MathML" to math.descriptor!!.getElementsDescriptors(math)
+ ).associate { (namespace, tags) ->
+ Pair(namespace,
+ tags.sortedBy { it.name }.associate { tag ->
+ Pair(tag.name, tag.getAttributesDescriptors(null).map { it.name }.filter { !it.startsWith("aria-") }
+ .distinct()
+ .sorted())
+ })
+ }
+ val htmlMap = map["HTML"]!!
+ val dlAttrs = htmlMap["dl"]!!.toSet()
+ val acronymAttrs = htmlMap["acronym"]!!.toSet()
+ val htmlAttrs = htmlMap["div"]!!.filter { dlAttrs.contains(it) && acronymAttrs.contains(it) }.toSet()
+
+ val baseHtmlAttrs = htmlMap["frame"]!!.filter { htmlAttrs.contains(it) }.toSet()
+
+ val svgMap = map["SVG"]!!
+ val svgBasicAttrs = setOf("base", "id", "space")
+
+ val gAttrs = svgMap["g"]!!.toSet()
+ val animateAttrs = svgMap["animate"]!!.toSet()
+ val svgAttrs = svgMap["marker"]!!.filter { gAttrs.contains(it) && animateAttrs.contains(it) }.toSet()
+ assert(svgAttrs.containsAll(svgBasicAttrs))
+
+ val lineAttrs = svgMap["line"]!!.toSet()
+ val defsAttrs = svgMap["defs"]!!.toSet()
+ val circleAttrs = svgMap["circle"]!!.toSet()
+ val textAttrs = svgMap["text"]!!.toSet()
+ val svgGraphicAttrs = svgMap["filter"]!!.filter {
+ lineAttrs.contains(it)
+ && defsAttrs.contains(it)
+ && circleAttrs.contains(it)
+ && textAttrs.contains(it)
+ }.toSet()
+ assert(svgGraphicAttrs.containsAll(svgAttrs))
+
+ val svgTextAttrs = svgMap["filter"]!!.filter { defsAttrs.contains(it) && textAttrs.contains(it) }.toSet()
+ assert(svgTextAttrs.containsAll(svgGraphicAttrs))
+
+ val mathMap = map["MathML"]!!
+ val mathBasicAttrs = setOf("class", "href", "id", "xref")
+ val mathAttrs = mathMap["factorial"]!!.toSet()
+ assert(mathAttrs.containsAll(mathBasicAttrs))
+
+ return """
+ // Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
+ package com.intellij.xml.util
+
+ import com.intellij.psi.tree.IStubFileElementType
+ import com.intellij.util.containers.CollectionFactory
+ import com.intellij.util.containers.Interner
+ import java.util.*
+
+ /**
+ * This utility object provides names for all known HTML, SVG and MathML elements and attributes. It is created
+ * statically and can be used in parsers or lexers. Any stubbed file element types, which are created by parsers
+ * using information provided by this class should include [Html5TagAndAttributeNamesProvider.VERSION] in
+ * [IStubFileElementType.getStubVersion] version calculations.
+ */
+ object Html5TagAndAttributeNamesProvider {
+
+ /**
+ * Version of the information, should be used to calculate stub version,
+ * if parser or lexer depends on the information from this object.
+ */
+ const val VERSION = $version
+
+ /**
+ * Retrieves the set of all known HTML, SVG or MathML attributes of tags with a particular name.
+ *
+ * @param namespace tag's namespace - HTML, SVG or MathML
+ * @param tagName
+ * @param caseSensitive specifies whether the returned attribute names set should be case sensitive or not
+ * @return a set containing [String] objects, or [null] if tag was not found. The set's contains check respects
+ * `caseSensitive` parameter.
+ */
+ @JvmStatic
+ fun getTagAttributes(namespace: Namespace, tagName: CharSequence, caseSensitive: Boolean): Set? =
+ getMap(namespace, caseSensitive).let { it[tagName] }
+
+ /**
+ * Retrieves the set of all known HTML, SVG and MathML attributes of tags with a particular name.
+ *
+ * @param tagName
+ * @param caseSensitive specifies whether the returned attribute names set should be case sensitive or not
+ * @return a set containing [String] objects, or [null] if tag was not found. The set's contains check respects
+ * `caseSensitive` parameter.
+ */
+ @JvmStatic
+ fun getTagAttributes(tagName: CharSequence, caseSensitive: Boolean): Set? =
+ getMap(caseSensitive).let { it[tagName] }
+
+ /**
+ * Retrieves the set of all known HTML, SVG or MathML tags
+ *
+ * @param namespace tag's namespace - HTML, SVG or MathML
+ * @param caseSensitive specifies whether the returned tag names set should be case sensitive or not
+ * @return a set containing [String] objects. The set's contains check respects [caseSensitive] parameter.
+ */
+ @JvmStatic
+ fun getTags(namespace: Namespace, caseSensitive: Boolean): Set =
+ getMap(namespace, caseSensitive).keys
+
+ /**
+ * Retrieves the set of all known HTML, SVG and MathML tags
+ *
+ * @param caseSensitive specifies whether the returned tag names set should be case sensitive or not
+ * @return a set containing [String] objects. The set's contains check respects [caseSensitive] parameter.
+ */
+ @JvmStatic
+ fun getTags(caseSensitive: Boolean): Set =
+ getMap(caseSensitive).keys
+
+ enum class Namespace {
+ HTML,
+ SVG,
+ MathML
+ }
+
+ private fun getMap(namespace: Namespace, caseSensitive: Boolean): Map> =
+ (if (caseSensitive) namespacedTagToAttributeMapCaseSensitive else namespacedTagToAttributeMapCaseInsensitive)[namespace]!!
+
+ private fun getMap(caseSensitive: Boolean): Map> =
+ if (caseSensitive) tagToAttributeMapCaseSensitive else tagToAttributeMapCaseInsensitive
+
+ private val baseHtmlAttrs = listOf(
+ ${baseHtmlAttrs.joinToString { '"' + it + '"' }}
+ )
+
+ private val htmlAttrs = baseHtmlAttrs + listOf(
+ ${(htmlAttrs - baseHtmlAttrs).joinToString { '"' + it + '"' }}
+ )
+
+ private val svgBasicAttrs = listOf(
+ ${svgBasicAttrs.joinToString { '"' + it + '"' }}
+ )
+
+ private val svgAttrs = svgBasicAttrs + listOf(
+ ${(svgAttrs - svgBasicAttrs).joinToString { '"' + it + '"' }}
+ )
+
+ private val svgGraphicAttrs = svgAttrs + listOf(
+ ${(svgGraphicAttrs - svgAttrs).joinToString { '"' + it + '"' }}
+ )
+
+ private val svgTextAttrs = svgGraphicAttrs + listOf(
+ ${(svgTextAttrs - svgGraphicAttrs).joinToString { '"' + it + '"' }}
+ )
+
+ private val mathBasicAttrs = listOf(
+ ${mathBasicAttrs.joinToString { '"' + it + '"' }}
+ )
+
+ private val mathAttrs = mathBasicAttrs + listOf(
+ ${(mathAttrs - mathBasicAttrs).joinToString { '"' + it + '"' }}
+ )
+
+ private val namespacedTagToAttributeMapCaseSensitive: Map>> =
+ createMap(true)
+
+ private val namespacedTagToAttributeMapCaseInsensitive: Map>> =
+ createMap(false)
+
+ private val tagToAttributeMapCaseSensitive: Map> =
+ createMergedMap(true)
+
+ private val tagToAttributeMapCaseInsensitive: Map> =
+ createMergedMap(false)
+
+ private fun createMergedMap(caseSensitive: Boolean): Map> =
+ namespacedTagToAttributeMapCaseSensitive
+ .flatMap { (_, tags) ->
+ tags.entries.map { Pair(it.key.toString(), it.value) }
+ }
+ .groupingBy { it.first }
+ .aggregateTo(CollectionFactory.createCharSequenceMap>(caseSensitive)) { _, result, (_, attrs), _ ->
+ (result ?: CollectionFactory.createCharSequenceSet(caseSensitive)).also { it.addAll(attrs) }
+ }
+ .mapValues { Collections.unmodifiableSet(it.value) as Set }
+ .let { Collections.unmodifiableMap(it) }
+
+ private fun createMap(caseSensitive: Boolean): Map>> {
+ val interner = Interner.createStringInterner()
+
+ fun attrs(base: List, vararg items: String): Set =
+ Collections.unmodifiableSet(
+ CollectionFactory.createCharSequenceSet(caseSensitive).apply { addAll((base + items).map { interner.intern(it) }) }
+ )
+
+ fun tags(vararg items: Pair>): Map> =
+ items.toMap(CollectionFactory.createCharSequenceMap>(caseSensitive))
+ .let { Collections.unmodifiableMap(it) }
+
+ return mapOf(
+ ${
+ map.entries.joinToString(",\n ") { (namespace, tags) ->
+ "Namespace.${namespace} to tags(\n " +
+ tags.entries.filter { it.value.isNotEmpty() }.joinToString(",\n ") { (tagName, attrs) ->
+ val (tag, list) = if (attrs.containsAll(htmlAttrs))
+ Pair("htmlAttrs", attrs - htmlAttrs)
+ else if (attrs.containsAll(baseHtmlAttrs))
+ Pair("baseHtmlAttrs", attrs - baseHtmlAttrs)
+ else if (attrs.containsAll(svgTextAttrs))
+ Pair("svgTextAttrs", attrs - svgTextAttrs)
+ else if (attrs.containsAll(svgGraphicAttrs))
+ Pair("svgGraphicAttrs", attrs - svgGraphicAttrs)
+ else if (attrs.containsAll(svgAttrs))
+ Pair("svgAttrs", attrs - svgAttrs)
+ else if (attrs.containsAll(mathAttrs))
+ Pair("mathAttrs", attrs - mathAttrs)
+ else if (attrs.containsAll(svgBasicAttrs))
+ Pair("svgBasicAttrs", attrs - svgBasicAttrs)
+ else if (attrs.containsAll(mathBasicAttrs))
+ Pair("mathBasicAttrs", attrs - mathBasicAttrs)
+ else
+ Pair("emptyList()", attrs)
+
+ """ "${tagName}" to attrs($tag, ${list.joinToString { '"' + it + '"' }})"""
+ } + "\n )"
+ }
+ }
+ )
+ }
+ }
+ """.trimIndent()
+ }
+
+}
\ No newline at end of file
diff --git a/xml/xml-psi-impl/gen/com/intellij/xml/util/Html5TagAndAttributeNamesProvider.kt b/xml/xml-psi-impl/gen/com/intellij/xml/util/Html5TagAndAttributeNamesProvider.kt
new file mode 100644
index 000000000000..5b27a5b79a32
--- /dev/null
+++ b/xml/xml-psi-impl/gen/com/intellij/xml/util/Html5TagAndAttributeNamesProvider.kt
@@ -0,0 +1,492 @@
+// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
+package com.intellij.xml.util
+
+import com.intellij.psi.tree.IStubFileElementType
+import com.intellij.util.containers.CollectionFactory
+import com.intellij.util.containers.Interner
+import java.util.*
+
+/**
+ * This utility object provides names for all known HTML, SVG and MathML elements and attributes. It is created
+ * statically and can be used in parsers or lexers. Any stubbed file element types, which are created by parsers
+ * using information provided by this class should include [Html5TagAndAttributeNamesProvider.VERSION] in
+ * [IStubFileElementType.getStubVersion] version calculations.
+ */
+object Html5TagAndAttributeNamesProvider {
+
+ /**
+ * Version of the information, should be used to calculate stub version,
+ * if parser or lexer depends on the information from this object.
+ */
+ const val VERSION = 1
+
+ /**
+ * Retrieves the set of all known HTML, SVG or MathML attributes of tags with a particular name.
+ *
+ * @param namespace tag's namespace - HTML, SVG or MathML
+ * @param tagName
+ * @param caseSensitive specifies whether the returned attribute names set should be case sensitive or not
+ * @return a set containing [String] objects, or [null] if tag was not found. The set's contains check respects
+ * `caseSensitive` parameter.
+ */
+ @JvmStatic
+ fun getTagAttributes(namespace: Namespace, tagName: CharSequence, caseSensitive: Boolean): Set? =
+ getMap(namespace, caseSensitive).let { it[tagName] }
+
+ /**
+ * Retrieves the set of all known HTML, SVG and MathML attributes of tags with a particular name.
+ *
+ * @param tagName
+ * @param caseSensitive specifies whether the returned attribute names set should be case sensitive or not
+ * @return a set containing [String] objects, or [null] if tag was not found. The set's contains check respects
+ * `caseSensitive` parameter.
+ */
+ @JvmStatic
+ fun getTagAttributes(tagName: CharSequence, caseSensitive: Boolean): Set? =
+ getMap(caseSensitive).let { it[tagName] }
+
+ /**
+ * Retrieves the set of all known HTML, SVG or MathML tags
+ *
+ * @param namespace tag's namespace - HTML, SVG or MathML
+ * @param caseSensitive specifies whether the returned tag names set should be case sensitive or not
+ * @return a set containing [String] objects. The set's contains check respects [caseSensitive] parameter.
+ */
+ @JvmStatic
+ fun getTags(namespace: Namespace, caseSensitive: Boolean): Set =
+ getMap(namespace, caseSensitive).keys
+
+ /**
+ * Retrieves the set of all known HTML, SVG and MathML tags
+ *
+ * @param caseSensitive specifies whether the returned tag names set should be case sensitive or not
+ * @return a set containing [String] objects. The set's contains check respects [caseSensitive] parameter.
+ */
+ @JvmStatic
+ fun getTags(caseSensitive: Boolean): Set =
+ getMap(caseSensitive).keys
+
+ enum class Namespace {
+ HTML,
+ SVG,
+ MathML
+ }
+
+ private fun getMap(namespace: Namespace, caseSensitive: Boolean): Map> =
+ (if (caseSensitive) namespacedTagToAttributeMapCaseSensitive else namespacedTagToAttributeMapCaseInsensitive)[namespace]!!
+
+ private fun getMap(caseSensitive: Boolean): Map> =
+ if (caseSensitive) tagToAttributeMapCaseSensitive else tagToAttributeMapCaseInsensitive
+
+ private val baseHtmlAttrs = listOf(
+ "accesskey", "autocapitalize", "autofocus", "base", "class", "contenteditable", "dir", "draggable", "enterkeyhint", "hidden", "id", "inert", "inputmode", "is", "lang", "nonce", "onabort", "onauxclick", "onbeforeinput", "onbeforematch", "onblur", "oncancel", "oncanplay", "oncanplaythrough", "onchange", "onclick", "onclose", "oncontextlost", "oncontextmenu", "oncontextrestored", "oncopy", "oncuechange", "oncut", "ondblclick", "ondrag", "ondragend", "ondragenter", "ondragleave", "ondragover", "ondragstart", "ondrop", "ondurationchange", "onemptied", "onended", "onerror", "onfocus", "onfocusin", "onfocusout", "onformdata", "ongotpointercapture", "oninput", "oninvalid", "onkeydown", "onkeypress", "onkeyup", "onload", "onloadeddata", "onloadedmetadata", "onloadstart", "onlostpointercapture", "onmousedown", "onmouseenter", "onmouseleave", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "onpaste", "onpause", "onplay", "onplaying", "onpointercancel", "onpointerdown", "onpointerenter", "onpointerleave", "onpointermove", "onpointerout", "onpointerover", "onpointerrawupdate", "onpointerup", "onprogress", "onratechange", "onreset", "onresize", "onscroll", "onscrollend", "onsecuritypolicyviolation", "onseeked", "onseeking", "onselect", "onslotchange", "onstalled", "onsubmit", "onsuspend", "ontimeupdate", "ontoggle", "ontransitioncancel", "ontransitionend", "ontransitionrun", "ontransitionstart", "onvolumechange", "onwaiting", "onwheel", "slot", "space", "spellcheck", "style", "tabindex", "title", "translate"
+ )
+
+ private val htmlAttrs = baseHtmlAttrs + listOf(
+ "about", "content", "datatype", "inlist", "itemid", "itemprop", "itemref", "itemscope", "itemtype", "prefix", "property", "rel", "resource", "rev", "typeof", "vocab"
+ )
+
+ private val svgBasicAttrs = listOf(
+ "base", "id", "space"
+ )
+
+ private val svgAttrs = svgBasicAttrs + listOf(
+ "externalResourcesRequired", "fill", "focusable", "lang", "tabindex"
+ )
+
+ private val svgGraphicAttrs = svgAttrs + listOf(
+ "class", "clip-path", "clip-rule", "color", "color-interpolation", "color-rendering", "cursor", "display", "fill-opacity", "fill-rule", "filter", "image-rendering", "mask", "opacity", "pointer-events", "shape-rendering", "stroke", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke-width", "style", "text-rendering", "visibility"
+ )
+
+ private val svgTextAttrs = svgGraphicAttrs + listOf(
+ "alignment-baseline", "baseline-shift", "direction", "dominant-baseline", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "glyph-orientation-horizontal", "glyph-orientation-vertical", "kerning", "letter-spacing", "text-anchor", "text-decoration", "unicode-bidi", "word-spacing", "writing-mode"
+ )
+
+ private val mathBasicAttrs = listOf(
+ "class", "href", "id", "xref"
+ )
+
+ private val mathAttrs = mathBasicAttrs + listOf(
+ "definitionURL", "encoding", "other", "style"
+ )
+
+ private val namespacedTagToAttributeMapCaseSensitive: Map>> =
+ createMap(true)
+
+ private val namespacedTagToAttributeMapCaseInsensitive: Map>> =
+ createMap(false)
+
+ private val tagToAttributeMapCaseSensitive: Map> =
+ createMergedMap(true)
+
+ private val tagToAttributeMapCaseInsensitive: Map> =
+ createMergedMap(false)
+
+ private fun createMergedMap(caseSensitive: Boolean): Map> =
+ namespacedTagToAttributeMapCaseSensitive
+ .flatMap { (_, tags) ->
+ tags.entries.map { Pair(it.key.toString(), it.value) }
+ }
+ .groupingBy { it.first }
+ .aggregateTo(CollectionFactory.createCharSequenceMap>(caseSensitive)) { _, result, (_, attrs), _ ->
+ (result ?: CollectionFactory.createCharSequenceSet(caseSensitive)).also { it.addAll(attrs) }
+ }
+ .mapValues { Collections.unmodifiableSet(it.value) as Set }
+ .let { Collections.unmodifiableMap(it) }
+
+ private fun createMap(caseSensitive: Boolean): Map>> {
+ val interner = Interner.createStringInterner()
+
+ fun attrs(base: List, vararg items: String): Set =
+ Collections.unmodifiableSet(
+ CollectionFactory.createCharSequenceSet(caseSensitive).apply { addAll((base + items).map { interner.intern(it) }) }
+ )
+
+ fun tags(vararg items: Pair>): Map> =
+ items.toMap(CollectionFactory.createCharSequenceMap>(caseSensitive))
+ .let { Collections.unmodifiableMap(it) }
+
+ return mapOf(
+ Namespace.HTML to tags(
+ "a" to attrs(htmlAttrs, "charset", "coords", "download", "href", "hreflang", "methods", "name", "referrerpolicy", "role", "shape", "target", "type", "urn"),
+ "abbr" to attrs(htmlAttrs, "role"),
+ "acronym" to attrs(htmlAttrs, ),
+ "address" to attrs(htmlAttrs, "role"),
+ "applet" to attrs(htmlAttrs, "alt", "archive", "code", "codebase", "height", "name", "width"),
+ "area" to attrs(htmlAttrs, "alt", "coords", "download", "href", "hreflang", "nohref", "role", "shape", "target", "type"),
+ "article" to attrs(htmlAttrs, "role"),
+ "aside" to attrs(htmlAttrs, "role"),
+ "audio" to attrs(htmlAttrs, "autoplay", "controls", "crossorigin", "loop", "muted", "preload", "role", "src"),
+ "b" to attrs(htmlAttrs, "role"),
+ "base" to attrs(baseHtmlAttrs, "about", "content", "datatype", "href", "inlist", "itemid", "itemprop", "itemref", "itemscope", "itemtype", "prefix", "property", "resource", "rev", "target", "typeof", "vocab"),
+ "basefont" to attrs(htmlAttrs, "color", "face", "size"),
+ "bdi" to attrs(htmlAttrs, "role"),
+ "bdo" to attrs(htmlAttrs, "role"),
+ "big" to attrs(htmlAttrs, ),
+ "blockquote" to attrs(htmlAttrs, "cite", "role"),
+ "body" to attrs(htmlAttrs, "alink", "background", "bgcolor", "bottommargin", "leftmargin", "link", "marginheight", "marginwidth", "onafterprint", "onbeforeprint", "onbeforeunload", "onhashchange", "onlanguagechange", "onmessage", "onmessageerror", "onoffline", "ononline", "onpagehide", "onpageshow", "onpopstate", "onrejectionhandled", "onstorage", "onunhandledrejection", "onunload", "rightmargin", "role", "text", "topmargin", "vlink"),
+ "br" to attrs(htmlAttrs, "clear", "role"),
+ "button" to attrs(htmlAttrs, "datafld", "dataformatas", "datasrc", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "name", "role", "type", "value"),
+ "canvas" to attrs(htmlAttrs, "height", "role", "width"),
+ "caption" to attrs(htmlAttrs, "align"),
+ "center" to attrs(htmlAttrs, ),
+ "cite" to attrs(htmlAttrs, "role"),
+ "code" to attrs(htmlAttrs, "role"),
+ "col" to attrs(htmlAttrs, "align", "char", "charoff", "span", "valign", "width"),
+ "colgroup" to attrs(htmlAttrs, "align", "char", "charoff", "span", "valign", "width"),
+ "data" to attrs(htmlAttrs, "role", "value"),
+ "datalist" to attrs(htmlAttrs, "role"),
+ "dd" to attrs(htmlAttrs, "role"),
+ "del" to attrs(htmlAttrs, "cite", "datetime", "role"),
+ "details" to attrs(htmlAttrs, "open", "role"),
+ "dfn" to attrs(htmlAttrs, "role"),
+ "dialog" to attrs(htmlAttrs, "open", "role"),
+ "dir" to attrs(htmlAttrs, "compact"),
+ "div" to attrs(htmlAttrs, "align", "datafld", "dataformatas", "datasrc", "role"),
+ "dl" to attrs(htmlAttrs, "compact", "role"),
+ "dt" to attrs(htmlAttrs, "role"),
+ "em" to attrs(htmlAttrs, "role"),
+ "embed" to attrs(emptyList(), "base", "lang", "onbeforeinput", "role", "space"),
+ "fieldset" to attrs(htmlAttrs, "disabled", "form", "name", "role"),
+ "figcaption" to attrs(htmlAttrs, "role"),
+ "figure" to attrs(htmlAttrs, "role"),
+ "font" to attrs(htmlAttrs, "color", "face", "role", "size"),
+ "footer" to attrs(htmlAttrs, "role"),
+ "form" to attrs(htmlAttrs, "accept-charset", "action", "autocomplete", "enctype", "method", "name", "novalidate", "role", "target"),
+ "frame" to attrs(baseHtmlAttrs, "frameborder", "longdesc", "marginheight", "marginwidth", "name", "noresize", "scrolling", "src"),
+ "frameset" to attrs(htmlAttrs, "columns", "onunload", "rows"),
+ "h1" to attrs(htmlAttrs, "align", "role"),
+ "h2" to attrs(htmlAttrs, "align", "role"),
+ "h3" to attrs(htmlAttrs, "align", "role"),
+ "h4" to attrs(htmlAttrs, "align", "role"),
+ "h5" to attrs(htmlAttrs, "align", "role"),
+ "h6" to attrs(htmlAttrs, "align", "role"),
+ "head" to attrs(htmlAttrs, "profile"),
+ "header" to attrs(htmlAttrs, "role"),
+ "hgroup" to attrs(htmlAttrs, "role"),
+ "hr" to attrs(htmlAttrs, "align", "color", "noshade", "role", "size", "width"),
+ "html" to attrs(htmlAttrs, "manifest", "version"),
+ "i" to attrs(htmlAttrs, "role"),
+ "iframe" to attrs(htmlAttrs, "align", "allow", "allowfullscreen", "allowtransparency", "frameborder", "height", "hspace", "loading", "longdesc", "marginheight", "marginwidth", "name", "referrerpolicy", "role", "sandbox", "scrolling", "src", "srcdoc", "vspace", "width"),
+ "img" to attrs(htmlAttrs, "align", "alt", "border", "crossorigin", "decoding", "generator-unable-to-provide-required-alt", "height", "hspace", "ismap", "loading", "longdesc", "name", "referrerpolicy", "role", "sizes", "src", "srcset", "usemap", "vspace", "width"),
+ "input" to attrs(htmlAttrs, "accept", "align", "alt", "autocomplete", "capture", "checked", "datafld", "dataformatas", "datasrc", "dirname", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "height", "hspace", "list", "max", "maxlength", "min", "minlength", "multiple", "name", "pattern", "placeholder", "readonly", "required", "role", "size", "src", "step", "type", "usemap", "value", "vspace", "width"),
+ "ins" to attrs(htmlAttrs, "cite", "datetime", "role"),
+ "kbd" to attrs(htmlAttrs, "role"),
+ "label" to attrs(htmlAttrs, "for"),
+ "legend" to attrs(htmlAttrs, "align"),
+ "li" to attrs(htmlAttrs, "role", "type", "value"),
+ "link" to attrs(htmlAttrs, "as", "blocking", "charset", "color", "crossorigin", "disabled", "href", "hreflang", "imagesizes", "imagesrcset", "integrity", "media", "methods", "referrerpolicy", "role", "scope", "sizes", "target", "type", "updateviacache", "urn", "workertype"),
+ "main" to attrs(htmlAttrs, "role"),
+ "map" to attrs(htmlAttrs, "name"),
+ "mark" to attrs(htmlAttrs, "role"),
+ "math" to attrs(mathBasicAttrs, "accent", "accentunder", "align", "alignmentscope", "altimg", "altimg-height", "altimg-valign", "altimg-width", "alttext", "bevelled", "cdgroup", "charalign", "charspacing", "close", "columnalign", "columnlines", "columnspacing", "columnspan", "columnwidth", "crossout", "decimalpoint", "denomalign", "depth", "dir", "display", "displaystyle", "edge", "equalcolumns", "equalrows", "fence", "form", "frame", "framespacing", "groupalign", "height", "indentalign", "indentalignfirst", "indentalignlast", "indentshift", "indentshiftfirst", "indentshiftlast", "indenttarget", "infixlinebreakstyle", "largeop", "leftoverhang", "length", "linebreak", "linebreakmultchar", "linebreakstyle", "lineleading", "linethickness", "location", "longdivstyle", "lquote", "lspace", "macros", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "maxwidth", "minlabelspacing", "minsize", "mode", "movablelimits", "mslinethickness", "notation", "numalign", "open", "other", "overflow", "position", "rightoverhang", "role", "rowalign", "rowlines", "rowspacing", "rowspan", "rquote", "rspace", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "shift", "side", "stackalign", "stretchy", "style", "subscriptshift", "superscriptshift", "symmetric", "valign", "width"),
+ "menu" to attrs(htmlAttrs, "compact", "role"),
+ "meta" to attrs(baseHtmlAttrs, "about", "charset", "content", "datatype", "http-equiv", "inlist", "itemid", "itemprop", "itemref", "itemscope", "itemtype", "media", "name", "prefix", "property", "resource", "role", "scheme", "typeof", "vocab"),
+ "meter" to attrs(htmlAttrs, "high", "low", "max", "min", "optimum", "value"),
+ "nav" to attrs(htmlAttrs, "role"),
+ "noframes" to attrs(htmlAttrs, ),
+ "noscript" to attrs(htmlAttrs, ),
+ "object" to attrs(htmlAttrs, "align", "archive", "border", "classid", "code", "codebase", "codetype", "data", "datafld", "dataformatas", "datasrc", "declare", "form", "height", "hspace", "name", "role", "standby", "type", "usemap", "vspace", "width"),
+ "ol" to attrs(htmlAttrs, "compact", "reversed", "role", "start", "type"),
+ "optgroup" to attrs(htmlAttrs, "disabled", "label", "role"),
+ "option" to attrs(htmlAttrs, "disabled", "label", "name", "role", "selected", "value"),
+ "output" to attrs(htmlAttrs, "for", "form", "name", "role"),
+ "p" to attrs(htmlAttrs, "align", "role"),
+ "param" to attrs(htmlAttrs, "name", "type", "value", "valuetype"),
+ "picture" to attrs(htmlAttrs, ),
+ "pre" to attrs(htmlAttrs, "role", "width"),
+ "progress" to attrs(htmlAttrs, "max", "role", "value"),
+ "q" to attrs(htmlAttrs, "cite", "role"),
+ "rb" to attrs(htmlAttrs, "role"),
+ "rp" to attrs(htmlAttrs, "role"),
+ "rt" to attrs(htmlAttrs, "role"),
+ "rtc" to attrs(htmlAttrs, "role"),
+ "ruby" to attrs(htmlAttrs, "role"),
+ "s" to attrs(htmlAttrs, "role"),
+ "samp" to attrs(htmlAttrs, "role"),
+ "script" to attrs(htmlAttrs, "async", "blocking", "charset", "crossorigin", "defer", "event", "for", "integrity", "language", "nomodule", "referrerpolicy", "src", "type"),
+ "section" to attrs(htmlAttrs, "role"),
+ "select" to attrs(htmlAttrs, "autocomplete", "datafld", "dataformatas", "datasrc", "disabled", "form", "multiple", "name", "required", "role", "size"),
+ "slot" to attrs(htmlAttrs, "name", "role"),
+ "small" to attrs(htmlAttrs, "role"),
+ "source" to attrs(htmlAttrs, "height", "media", "sizes", "src", "srcset", "type", "width"),
+ "span" to attrs(htmlAttrs, "datafld", "dataformatas", "datasrc", "role"),
+ "strike" to attrs(htmlAttrs, ),
+ "strong" to attrs(htmlAttrs, "role"),
+ "style" to attrs(htmlAttrs, "blocking", "media", "type"),
+ "sub" to attrs(htmlAttrs, "role"),
+ "summary" to attrs(htmlAttrs, "role"),
+ "sup" to attrs(htmlAttrs, "role"),
+ "svg" to attrs(svgTextAttrs, "baseProfile", "clip", "color-interpolation-filters", "color-profile", "contentScriptType", "contentStyleType", "enable-background", "flood-color", "flood-opacity", "height", "lighting-color", "marker-end", "marker-mid", "marker-start", "onabort", "onactivate", "onclick", "onerror", "onfocusin", "onfocusout", "onload", "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "onresize", "onscroll", "onunload", "onzoom", "overflow", "preserveAspectRatio", "requiredExtensions", "requiredFeatures", "role", "stop-color", "stop-opacity", "systemLanguage", "version", "viewBox", "width", "x", "y", "zoomAndPan"),
+ "table" to attrs(htmlAttrs, "align", "bgcolor", "border", "cellpadding", "cellspacing", "datafld", "dataformatas", "datapagesize", "datasrc", "frame", "role", "rules", "summary", "valign", "width"),
+ "tbody" to attrs(htmlAttrs, "align", "char", "charoff", "role", "valign"),
+ "td" to attrs(htmlAttrs, "abbr", "align", "axis", "bgcolor", "char", "charoff", "colspan", "headers", "height", "nowrap", "role", "rowspan", "scope", "valign", "width"),
+ "template" to attrs(htmlAttrs, "span", "src"),
+ "textarea" to attrs(htmlAttrs, "autocomplete", "cols", "datafld", "dataformatas", "datasrc", "dirname", "disabled", "form", "maxlength", "minlength", "name", "placeholder", "readonly", "required", "role", "rows", "wrap"),
+ "tfoot" to attrs(htmlAttrs, "align", "char", "charoff", "role", "valign"),
+ "th" to attrs(htmlAttrs, "abbr", "align", "axis", "bgcolor", "char", "charoff", "colspan", "headers", "height", "nowrap", "role", "rowspan", "scope", "valign", "width"),
+ "thead" to attrs(htmlAttrs, "align", "char", "charoff", "role", "valign"),
+ "time" to attrs(htmlAttrs, "datetime", "role"),
+ "title" to attrs(htmlAttrs, ),
+ "tr" to attrs(htmlAttrs, "align", "bgcolor", "char", "charoff", "role", "valign"),
+ "track" to attrs(htmlAttrs, "default", "kind", "label", "src", "srclang"),
+ "tt" to attrs(htmlAttrs, ),
+ "u" to attrs(htmlAttrs, "role"),
+ "ul" to attrs(htmlAttrs, "compact", "role", "type"),
+ "var" to attrs(htmlAttrs, "role"),
+ "video" to attrs(htmlAttrs, "autoplay", "controls", "crossorigin", "height", "loop", "muted", "playsinline", "poster", "preload", "role", "src", "width"),
+ "wbr" to attrs(htmlAttrs, "role")
+ ),
+ Namespace.SVG to tags(
+ "a" to attrs(svgTextAttrs, "actuate", "arcrole", "clip", "color-interpolation-filters", "color-profile", "enable-background", "flood-color", "flood-opacity", "href", "lighting-color", "marker-end", "marker-mid", "marker-start", "onactivate", "onclick", "onfocusin", "onfocusout", "onload", "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "overflow", "rel", "requiredExtensions", "requiredFeatures", "role", "show", "stop-color", "stop-opacity", "systemLanguage", "target", "title", "transform", "type"),
+ "altGlyphDef" to attrs(svgBasicAttrs, "focusable", "lang", "tabindex"),
+ "animate" to attrs(svgAttrs, "accumulate", "actuate", "additive", "arcrole", "attributeName", "attributeType", "begin", "by", "calcMode", "dur", "end", "from", "href", "keySplines", "keyTimes", "max", "min", "onbegin", "onend", "onload", "onrepeat", "repeatCount", "repeatDur", "requiredExtensions", "requiredFeatures", "restart", "role", "show", "systemLanguage", "title", "to", "type", "values"),
+ "animateColor" to attrs(svgAttrs, "accumulate", "actuate", "additive", "arcrole", "attributeName", "attributeType", "begin", "by", "calcMode", "dur", "end", "from", "href", "keySplines", "keyTimes", "max", "min", "onbegin", "onend", "onload", "onrepeat", "repeatCount", "repeatDur", "requiredExtensions", "requiredFeatures", "restart", "role", "show", "systemLanguage", "title", "to", "type", "values"),
+ "animateMotion" to attrs(svgAttrs, "accumulate", "actuate", "additive", "arcrole", "begin", "by", "calcMode", "dur", "end", "from", "href", "keyPoints", "keySplines", "keyTimes", "max", "min", "onbegin", "onend", "onload", "onrepeat", "origin", "path", "repeatCount", "repeatDur", "requiredExtensions", "requiredFeatures", "restart", "role", "rotate", "show", "systemLanguage", "title", "to", "type", "values"),
+ "animateTransform" to attrs(svgAttrs, "accumulate", "actuate", "additive", "arcrole", "attributeName", "attributeType", "begin", "by", "calcMode", "dur", "end", "from", "href", "keySplines", "keyTimes", "max", "min", "onbegin", "onend", "onload", "onrepeat", "repeatCount", "repeatDur", "requiredExtensions", "requiredFeatures", "restart", "role", "show", "systemLanguage", "title", "to", "type", "values"),
+ "circle" to attrs(svgGraphicAttrs, "cx", "cy", "onactivate", "onclick", "onfocusin", "onfocusout", "onload", "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "r", "requiredExtensions", "requiredFeatures", "role", "systemLanguage", "transform", "vector-effect"),
+ "clipPath" to attrs(svgTextAttrs, "clipPathUnits", "requiredExtensions", "requiredFeatures", "systemLanguage", "transform"),
+ "color-profile" to attrs(svgBasicAttrs, "actuate", "arcrole", "focusable", "href", "lang", "local", "name", "rendering-intent", "role", "show", "tabindex", "title", "type"),
+ "cursor" to attrs(svgBasicAttrs, "actuate", "arcrole", "externalResourcesRequired", "focusable", "href", "lang", "requiredExtensions", "requiredFeatures", "role", "show", "systemLanguage", "tabindex", "title", "type", "x", "y"),
+ "defs" to attrs(svgTextAttrs, "clip", "color-interpolation-filters", "color-profile", "enable-background", "flood-color", "flood-opacity", "lighting-color", "marker-end", "marker-mid", "marker-start", "onactivate", "onclick", "onfocusin", "onfocusout", "onload", "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "overflow", "requiredExtensions", "requiredFeatures", "stop-color", "stop-opacity", "systemLanguage", "transform"),
+ "desc" to attrs(svgBasicAttrs, "class", "focusable", "lang", "style", "tabindex"),
+ "ellipse" to attrs(svgGraphicAttrs, "cx", "cy", "onactivate", "onclick", "onfocusin", "onfocusout", "onload", "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "requiredExtensions", "requiredFeatures", "role", "rx", "ry", "systemLanguage", "transform", "vector-effect"),
+ "filter" to attrs(svgTextAttrs, "actuate", "arcrole", "clip", "color-interpolation-filters", "color-profile", "enable-background", "filterRes", "filterUnits", "flood-color", "flood-opacity", "height", "href", "lighting-color", "marker-end", "marker-mid", "marker-start", "overflow", "primitiveUnits", "role", "show", "stop-color", "stop-opacity", "title", "type", "width", "x", "y"),
+ "font" to attrs(svgTextAttrs, "clip", "color-interpolation-filters", "color-profile", "enable-background", "flood-color", "flood-opacity", "horiz-adv-x", "horiz-origin-x", "horiz-origin-y", "lighting-color", "marker-end", "marker-mid", "marker-start", "overflow", "stop-color", "stop-opacity", "vert-adv-y", "vert-origin-x", "vert-origin-y"),
+ "font-face" to attrs(svgBasicAttrs, "accent-height", "alphabetic", "ascent", "bbox", "cap-height", "descent", "focusable", "font-family", "font-size", "font-stretch", "font-style", "font-variant", "font-weight", "hanging", "ideographic", "lang", "mathematical", "overline-position", "overline-thickness", "panose-1", "slope", "stemh", "stemv", "strikethrough-position", "strikethrough-thickness", "tabindex", "underline-position", "underline-thickness", "unicode-range", "units-per-em", "v-alphabetic", "v-hanging", "v-ideographic", "v-mathematical", "widths", "x-height"),
+ "foreignObject" to attrs(svgTextAttrs, "clip", "color-interpolation-filters", "color-profile", "enable-background", "flood-color", "flood-opacity", "height", "lighting-color", "marker-end", "marker-mid", "marker-start", "onactivate", "onclick", "onfocusin", "onfocusout", "onload", "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "overflow", "requiredExtensions", "requiredFeatures", "role", "stop-color", "stop-opacity", "systemLanguage", "transform", "vector-effect", "width", "x", "y"),
+ "g" to attrs(svgTextAttrs, "clip", "color-interpolation-filters", "color-profile", "enable-background", "flood-color", "flood-opacity", "lighting-color", "marker-end", "marker-mid", "marker-start", "onactivate", "onclick", "onfocusin", "onfocusout", "onload", "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "overflow", "requiredExtensions", "requiredFeatures", "role", "stop-color", "stop-opacity", "systemLanguage", "transform"),
+ "image" to attrs(svgBasicAttrs, "actuate", "arcrole", "class", "clip", "clip-path", "clip-rule", "color", "color-interpolation", "color-profile", "color-rendering", "cursor", "display", "externalResourcesRequired", "fill-opacity", "filter", "focusable", "height", "href", "image-rendering", "lang", "mask", "onactivate", "onclick", "onfocusin", "onfocusout", "onload", "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "opacity", "overflow", "pointer-events", "preserveAspectRatio", "requiredExtensions", "requiredFeatures", "role", "shape-rendering", "show", "stroke-opacity", "style", "systemLanguage", "tabindex", "text-rendering", "title", "transform", "type", "vector-effect", "visibility", "width", "x", "y"),
+ "line" to attrs(svgGraphicAttrs, "marker-end", "marker-mid", "marker-start", "onactivate", "onclick", "onfocusin", "onfocusout", "onload", "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "requiredExtensions", "requiredFeatures", "role", "systemLanguage", "transform", "vector-effect", "x1", "x2", "y1", "y2"),
+ "linearGradient" to attrs(svgBasicAttrs, "actuate", "arcrole", "class", "color", "color-interpolation", "color-rendering", "externalResourcesRequired", "focusable", "gradientTransform", "gradientUnits", "href", "lang", "role", "show", "spreadMethod", "stop-color", "stop-opacity", "style", "tabindex", "title", "type", "x1", "x2", "y1", "y2"),
+ "marker" to attrs(svgTextAttrs, "clip", "color-interpolation-filters", "color-profile", "enable-background", "flood-color", "flood-opacity", "lighting-color", "marker-end", "marker-mid", "marker-start", "markerHeight", "markerUnits", "markerWidth", "orient", "overflow", "preserveAspectRatio", "refX", "refY", "stop-color", "stop-opacity", "viewBox"),
+ "mask" to attrs(svgTextAttrs, "clip", "color-interpolation-filters", "color-profile", "enable-background", "flood-color", "flood-opacity", "height", "lighting-color", "marker-end", "marker-mid", "marker-start", "maskContentUnits", "maskUnits", "overflow", "requiredExtensions", "requiredFeatures", "stop-color", "stop-opacity", "systemLanguage", "width", "x", "y"),
+ "metadata" to attrs(svgBasicAttrs, "focusable", "lang", "tabindex"),
+ "path" to attrs(svgGraphicAttrs, "d", "marker-end", "marker-mid", "marker-start", "onactivate", "onclick", "onfocusin", "onfocusout", "onload", "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "pathLength", "requiredExtensions", "requiredFeatures", "role", "systemLanguage", "transform", "vector-effect"),
+ "pattern" to attrs(svgTextAttrs, "actuate", "arcrole", "clip", "color-interpolation-filters", "color-profile", "enable-background", "flood-color", "flood-opacity", "height", "href", "lighting-color", "marker-end", "marker-mid", "marker-start", "overflow", "patternContentUnits", "patternTransform", "patternUnits", "preserveAspectRatio", "requiredExtensions", "requiredFeatures", "role", "show", "stop-color", "stop-opacity", "systemLanguage", "title", "type", "viewBox", "width", "x", "y"),
+ "polygon" to attrs(svgGraphicAttrs, "marker-end", "marker-mid", "marker-start", "onactivate", "onclick", "onfocusin", "onfocusout", "onload", "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "points", "requiredExtensions", "requiredFeatures", "role", "systemLanguage", "transform", "vector-effect"),
+ "polyline" to attrs(svgGraphicAttrs, "marker-end", "marker-mid", "marker-start", "onactivate", "onclick", "onfocusin", "onfocusout", "onload", "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "points", "requiredExtensions", "requiredFeatures", "role", "systemLanguage", "transform", "vector-effect"),
+ "radialGradient" to attrs(svgBasicAttrs, "actuate", "arcrole", "class", "color", "color-interpolation", "color-rendering", "cx", "cy", "externalResourcesRequired", "focusable", "fx", "fy", "gradientTransform", "gradientUnits", "href", "lang", "r", "role", "show", "spreadMethod", "stop-color", "stop-opacity", "style", "tabindex", "title", "type"),
+ "rect" to attrs(svgGraphicAttrs, "height", "onactivate", "onclick", "onfocusin", "onfocusout", "onload", "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "requiredExtensions", "requiredFeatures", "role", "rx", "ry", "systemLanguage", "transform", "vector-effect", "width", "x", "y"),
+ "script" to attrs(svgBasicAttrs, "actuate", "arcrole", "externalResourcesRequired", "focusable", "href", "lang", "role", "show", "tabindex", "title", "type"),
+ "set" to attrs(svgAttrs, "actuate", "arcrole", "attributeName", "attributeType", "begin", "dur", "end", "href", "max", "min", "onbegin", "onend", "onload", "onrepeat", "repeatCount", "repeatDur", "requiredExtensions", "requiredFeatures", "restart", "role", "show", "systemLanguage", "title", "to", "type"),
+ "style" to attrs(svgBasicAttrs, "lang", "media", "title", "type"),
+ "svg" to attrs(svgTextAttrs, "baseProfile", "clip", "color-interpolation-filters", "color-profile", "contentScriptType", "contentStyleType", "enable-background", "flood-color", "flood-opacity", "height", "lighting-color", "marker-end", "marker-mid", "marker-start", "onabort", "onactivate", "onclick", "onerror", "onfocusin", "onfocusout", "onload", "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "onresize", "onscroll", "onunload", "onzoom", "overflow", "preserveAspectRatio", "requiredExtensions", "requiredFeatures", "role", "stop-color", "stop-opacity", "systemLanguage", "version", "viewBox", "width", "x", "y", "zoomAndPan"),
+ "switch" to attrs(svgTextAttrs, "clip", "color-interpolation-filters", "color-profile", "enable-background", "flood-color", "flood-opacity", "lighting-color", "marker-end", "marker-mid", "marker-start", "onactivate", "onclick", "onfocusin", "onfocusout", "onload", "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "overflow", "requiredExtensions", "requiredFeatures", "stop-color", "stop-opacity", "systemLanguage", "transform"),
+ "symbol" to attrs(svgTextAttrs, "clip", "color-interpolation-filters", "color-profile", "enable-background", "flood-color", "flood-opacity", "height", "lighting-color", "marker-end", "marker-mid", "marker-start", "onactivate", "onclick", "onfocusin", "onfocusout", "onload", "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "overflow", "preserveAspectRatio", "role", "stop-color", "stop-opacity", "viewBox", "width"),
+ "text" to attrs(svgTextAttrs, "dx", "dy", "lengthAdjust", "onactivate", "onclick", "onfocusin", "onfocusout", "onload", "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "requiredExtensions", "requiredFeatures", "role", "rotate", "systemLanguage", "textLength", "transform", "vector-effect", "x", "y"),
+ "title" to attrs(svgBasicAttrs, "class", "focusable", "lang", "style", "tabindex"),
+ "use" to attrs(svgTextAttrs, "actuate", "arcrole", "clip", "color-interpolation-filters", "color-profile", "enable-background", "flood-color", "flood-opacity", "height", "href", "lighting-color", "marker-end", "marker-mid", "marker-start", "onactivate", "onclick", "onfocusin", "onfocusout", "onload", "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "overflow", "requiredExtensions", "requiredFeatures", "role", "show", "stop-color", "stop-opacity", "systemLanguage", "title", "transform", "type", "vector-effect", "width", "x", "y"),
+ "view" to attrs(svgBasicAttrs, "externalResourcesRequired", "focusable", "lang", "preserveAspectRatio", "tabindex", "viewBox", "viewTarget", "zoomAndPan")
+ ),
+ Namespace.MathML to tags(
+ "abs" to attrs(mathAttrs, ),
+ "and" to attrs(mathAttrs, ),
+ "apply" to attrs(mathBasicAttrs, "other", "style"),
+ "approx" to attrs(mathAttrs, ),
+ "arccos" to attrs(mathAttrs, ),
+ "arccosh" to attrs(mathAttrs, ),
+ "arccot" to attrs(mathAttrs, ),
+ "arccoth" to attrs(mathAttrs, ),
+ "arccsc" to attrs(mathAttrs, ),
+ "arccsch" to attrs(mathAttrs, ),
+ "arcsec" to attrs(mathAttrs, ),
+ "arcsech" to attrs(mathAttrs, ),
+ "arcsin" to attrs(mathAttrs, ),
+ "arcsinh" to attrs(mathAttrs, ),
+ "arctan" to attrs(mathAttrs, ),
+ "arctanh" to attrs(mathAttrs, ),
+ "arg" to attrs(mathAttrs, ),
+ "bind" to attrs(mathBasicAttrs, "other", "style"),
+ "card" to attrs(mathAttrs, ),
+ "cartesianproduct" to attrs(mathAttrs, ),
+ "cbytes" to attrs(mathAttrs, ),
+ "ceiling" to attrs(mathAttrs, ),
+ "cerror" to attrs(mathBasicAttrs, "other", "style"),
+ "ci" to attrs(mathAttrs, "type"),
+ "cn" to attrs(mathAttrs, "base", "type"),
+ "codomain" to attrs(mathAttrs, ),
+ "complexes" to attrs(mathAttrs, ),
+ "compose" to attrs(mathAttrs, ),
+ "conjugate" to attrs(mathAttrs, ),
+ "cos" to attrs(mathAttrs, ),
+ "cosh" to attrs(mathAttrs, ),
+ "cot" to attrs(mathAttrs, ),
+ "coth" to attrs(mathAttrs, ),
+ "cs" to attrs(mathAttrs, ),
+ "csc" to attrs(mathAttrs, ),
+ "csch" to attrs(mathAttrs, ),
+ "csymbol" to attrs(mathAttrs, "cd", "type"),
+ "curl" to attrs(mathAttrs, ),
+ "declare" to attrs(emptyList(), "definitionURL", "encoding", "nargs", "occurrence", "scope", "type"),
+ "determinant" to attrs(mathAttrs, ),
+ "diff" to attrs(mathAttrs, ),
+ "divergence" to attrs(mathAttrs, ),
+ "divide" to attrs(mathAttrs, ),
+ "domain" to attrs(mathAttrs, ),
+ "emptyset" to attrs(mathAttrs, ),
+ "eq" to attrs(mathAttrs, ),
+ "equivalent" to attrs(mathAttrs, ),
+ "eulergamma" to attrs(mathAttrs, ),
+ "exists" to attrs(mathAttrs, ),
+ "exp" to attrs(mathAttrs, ),
+ "exponentiale" to attrs(mathAttrs, ),
+ "factorial" to attrs(mathAttrs, ),
+ "factorof" to attrs(mathAttrs, ),
+ "false" to attrs(mathAttrs, ),
+ "floor" to attrs(mathAttrs, ),
+ "forall" to attrs(mathAttrs, ),
+ "gcd" to attrs(mathAttrs, ),
+ "geq" to attrs(mathAttrs, ),
+ "grad" to attrs(mathAttrs, ),
+ "gt" to attrs(mathAttrs, ),
+ "ident" to attrs(mathAttrs, ),
+ "image" to attrs(mathAttrs, ),
+ "imaginary" to attrs(mathAttrs, ),
+ "imaginaryi" to attrs(mathAttrs, ),
+ "implies" to attrs(mathAttrs, ),
+ "in" to attrs(mathAttrs, ),
+ "infinity" to attrs(mathAttrs, ),
+ "int" to attrs(mathAttrs, ),
+ "integers" to attrs(mathAttrs, ),
+ "intersect" to attrs(mathAttrs, ),
+ "interval" to attrs(mathAttrs, "closure"),
+ "inverse" to attrs(mathAttrs, ),
+ "lambda" to attrs(mathAttrs, ),
+ "laplacian" to attrs(mathAttrs, ),
+ "lcm" to attrs(mathAttrs, ),
+ "leq" to attrs(mathAttrs, ),
+ "limit" to attrs(mathAttrs, ),
+ "list" to attrs(mathAttrs, "order"),
+ "ln" to attrs(mathAttrs, ),
+ "log" to attrs(mathAttrs, ),
+ "lt" to attrs(mathAttrs, ),
+ "maction" to attrs(mathBasicAttrs, "actiontype", "mathbackground", "mathcolor", "other", "selection", "style"),
+ "maligngroup" to attrs(mathBasicAttrs, "groupalign", "mathbackground", "mathcolor", "other", "style"),
+ "malignmark" to attrs(mathBasicAttrs, "edge", "mathbackground", "mathcolor", "other", "style"),
+ "matrix" to attrs(mathAttrs, ),
+ "matrixrow" to attrs(mathAttrs, ),
+ "max" to attrs(mathAttrs, ),
+ "mean" to attrs(mathAttrs, ),
+ "median" to attrs(mathAttrs, ),
+ "menclose" to attrs(mathBasicAttrs, "mathbackground", "mathcolor", "notation", "other", "style"),
+ "merror" to attrs(mathBasicAttrs, "mathbackground", "mathcolor", "other", "style"),
+ "mfenced" to attrs(mathBasicAttrs, "close", "mathbackground", "mathcolor", "open", "other", "separators", "style"),
+ "mfrac" to attrs(mathBasicAttrs, "bevelled", "denomalign", "linethickness", "mathbackground", "mathcolor", "numalign", "other", "style"),
+ "mi" to attrs(mathBasicAttrs, "background", "color", "dir", "fontfamily", "fontsize", "fontstyle", "fontweight", "mathbackground", "mathcolor", "mathsize", "mathvariant", "other", "style"),
+ "min" to attrs(mathAttrs, ),
+ "minus" to attrs(mathAttrs, ),
+ "mlongdiv" to attrs(mathBasicAttrs, "longdivstyle", "mathbackground", "mathcolor", "other", "position", "shift", "style"),
+ "mmultiscripts" to attrs(mathBasicAttrs, "mathbackground", "mathcolor", "other", "style", "subscriptshift", "superscriptshift"),
+ "mn" to attrs(mathBasicAttrs, "background", "color", "dir", "fontfamily", "fontsize", "fontstyle", "fontweight", "mathbackground", "mathcolor", "mathsize", "mathvariant", "other", "style"),
+ "mo" to attrs(mathBasicAttrs, "accent", "background", "color", "dir", "fence", "fontfamily", "fontsize", "fontstyle", "fontweight", "form", "indentalign", "indentalignfirst", "indentalignlast", "indentshift", "indentshiftfirst", "indentshiftlast", "indenttarget", "largeop", "linebreak", "linebreakmultchar", "linebreakstyle", "lineleading", "lspace", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "other", "rspace", "separator", "stretchy", "style", "symmetric"),
+ "mode" to attrs(mathAttrs, ),
+ "moment" to attrs(mathAttrs, ),
+ "mover" to attrs(mathBasicAttrs, "accent", "align", "mathbackground", "mathcolor", "other", "style"),
+ "mpadded" to attrs(mathBasicAttrs, "depth", "height", "lspace", "mathbackground", "mathcolor", "other", "style", "voffset", "width"),
+ "mphantom" to attrs(mathBasicAttrs, "mathbackground", "mathcolor", "other", "style"),
+ "mroot" to attrs(mathBasicAttrs, "mathbackground", "mathcolor", "other", "style"),
+ "mrow" to attrs(mathBasicAttrs, "dir", "mathbackground", "mathcolor", "other", "style"),
+ "ms" to attrs(mathBasicAttrs, "background", "color", "dir", "fontfamily", "fontsize", "fontstyle", "fontweight", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "other", "rquote", "style"),
+ "mspace" to attrs(mathBasicAttrs, "background", "color", "depth", "dir", "fontfamily", "fontsize", "fontstyle", "fontweight", "height", "indentalign", "indentalignfirst", "indentalignlast", "indentshift", "indentshiftfirst", "indentshiftlast", "indenttarget", "linebreak", "mathbackground", "mathcolor", "mathsize", "mathvariant", "other", "style", "width"),
+ "msqrt" to attrs(mathBasicAttrs, "mathbackground", "mathcolor", "other", "style"),
+ "mstack" to attrs(mathBasicAttrs, "align", "charalign", "charspacing", "mathbackground", "mathcolor", "other", "stackalign", "style"),
+ "mstyle" to attrs(mathBasicAttrs, "accent", "accentunder", "align", "alignmentscope", "background", "bevelled", "charalign", "charspacing", "close", "color", "columnalign", "columnlines", "columnspacing", "columnspan", "columnwidth", "crossout", "decimalpoint", "denomalign", "depth", "dir", "displaystyle", "edge", "equalcolumns", "equalrows", "fence", "fontfamily", "fontsize", "fontstyle", "fontweight", "form", "frame", "framespacing", "groupalign", "height", "indentalign", "indentalignfirst", "indentalignlast", "indentshift", "indentshiftfirst", "indentshiftlast", "indenttarget", "infixlinebreakstyle", "largeop", "leftoverhang", "length", "linebreak", "linebreakmultchar", "linebreakstyle", "lineleading", "linethickness", "location", "longdivstyle", "lquote", "lspace", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "mediummathspace", "minlabelspacing", "minsize", "movablelimits", "mslinethickness", "notation", "numalign", "open", "other", "position", "rightoverhang", "rowalign", "rowlines", "rowspacing", "rowspan", "rquote", "rspace", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "shift", "side", "stackalign", "stretchy", "style", "subscriptshift", "superscriptshift", "symmetric", "thickmathspace", "thinmathspace", "valign", "verythickmathspace", "verythinmathspace", "veryverythickmathspace", "veryverythinmathspace", "width"),
+ "msub" to attrs(mathBasicAttrs, "mathbackground", "mathcolor", "other", "style", "subscriptshift"),
+ "msubsup" to attrs(mathBasicAttrs, "mathbackground", "mathcolor", "other", "style", "subscriptshift", "superscriptshift"),
+ "msup" to attrs(mathBasicAttrs, "mathbackground", "mathcolor", "other", "style", "superscriptshift"),
+ "mtable" to attrs(mathBasicAttrs, "align", "alignmentscope", "columnalign", "columnlines", "columnspacing", "columnwidth", "displaystyle", "equalcolumns", "equalrows", "frame", "framespacing", "groupalign", "mathbackground", "mathcolor", "minlabelspacing", "other", "rowalign", "rowlines", "rowspacing", "side", "style", "width"),
+ "mtext" to attrs(mathBasicAttrs, "background", "color", "dir", "fontfamily", "fontsize", "fontstyle", "fontweight", "mathbackground", "mathcolor", "mathsize", "mathvariant", "other", "style"),
+ "munder" to attrs(mathBasicAttrs, "accentunder", "align", "mathbackground", "mathcolor", "other", "style"),
+ "munderover" to attrs(mathBasicAttrs, "accent", "accentunder", "align", "mathbackground", "mathcolor", "other", "style"),
+ "naturalnumbers" to attrs(mathAttrs, ),
+ "neq" to attrs(mathAttrs, ),
+ "not" to attrs(mathAttrs, ),
+ "notanumber" to attrs(mathAttrs, ),
+ "notin" to attrs(mathAttrs, ),
+ "notprsubset" to attrs(mathAttrs, ),
+ "notsubset" to attrs(mathAttrs, ),
+ "or" to attrs(mathAttrs, ),
+ "outerproduct" to attrs(mathAttrs, ),
+ "partialdiff" to attrs(mathAttrs, ),
+ "pi" to attrs(mathAttrs, ),
+ "piecewise" to attrs(mathAttrs, ),
+ "plus" to attrs(mathAttrs, ),
+ "power" to attrs(mathAttrs, ),
+ "primes" to attrs(mathAttrs, ),
+ "product" to attrs(mathAttrs, ),
+ "prsubset" to attrs(mathAttrs, ),
+ "quotient" to attrs(mathAttrs, ),
+ "rationals" to attrs(mathAttrs, ),
+ "real" to attrs(mathAttrs, ),
+ "reals" to attrs(mathAttrs, ),
+ "rem" to attrs(mathAttrs, ),
+ "root" to attrs(mathAttrs, ),
+ "scalarproduct" to attrs(mathAttrs, ),
+ "sdev" to attrs(mathAttrs, ),
+ "sec" to attrs(mathAttrs, ),
+ "sech" to attrs(mathAttrs, ),
+ "selector" to attrs(mathAttrs, ),
+ "semantics" to attrs(mathAttrs, "cd", "name"),
+ "set" to attrs(mathAttrs, "type"),
+ "setdiff" to attrs(mathAttrs, ),
+ "share" to attrs(mathBasicAttrs, "other", "src", "style"),
+ "sin" to attrs(mathAttrs, ),
+ "sinh" to attrs(mathAttrs, ),
+ "subset" to attrs(mathAttrs, ),
+ "sum" to attrs(mathAttrs, ),
+ "tan" to attrs(mathAttrs, ),
+ "tanh" to attrs(mathAttrs, ),
+ "tendsto" to attrs(mathAttrs, "type"),
+ "times" to attrs(mathAttrs, ),
+ "transpose" to attrs(mathAttrs, ),
+ "true" to attrs(mathAttrs, ),
+ "union" to attrs(mathAttrs, ),
+ "variance" to attrs(mathAttrs, ),
+ "vector" to attrs(mathAttrs, ),
+ "vectorproduct" to attrs(mathAttrs, ),
+ "xor" to attrs(mathAttrs, )
+ )
+ )
+ }
+}
\ No newline at end of file
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/XmlProcessingInstructionManipulator.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/XmlProcessingInstructionManipulator.java
index 4b6bc26c6d15..c8d09344fee3 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/XmlProcessingInstructionManipulator.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/XmlProcessingInstructionManipulator.java
@@ -16,6 +16,7 @@
package com.intellij.psi.impl.source.resolve.reference.impl.manipulators;
import com.intellij.lang.ASTNode;
+import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.AbstractElementManipulator;
import com.intellij.psi.PsiElement;
@@ -30,10 +31,10 @@ import com.intellij.util.CharTable;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
-import static com.intellij.xml.util.documentation.HtmlDescriptorsTable.LOG;
-
public class XmlProcessingInstructionManipulator extends AbstractElementManipulator {
+ private static final Logger LOG = Logger.getInstance(XmlProcessingInstructionManipulator.class);
+
@Override
public XmlProcessingInstruction handleContentChange(@NotNull XmlProcessingInstruction element, @NotNull TextRange range, String newContent) throws IncorrectOperationException {
CheckUtil.checkWritable(element);
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/CompositeAttributeTagDescriptor.java b/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/CompositeAttributeTagDescriptor.java
deleted file mode 100644
index 7ce82d86a1aa..000000000000
--- a/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/CompositeAttributeTagDescriptor.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2000-2014 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.xml.util.documentation;
-
-import com.intellij.psi.xml.XmlTag;
-
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * @author maxim
- */
-class CompositeAttributeTagDescriptor extends HtmlAttributeDescriptor {
- final List attributes = new LinkedList<>();
-
- HtmlAttributeDescriptor findHtmlAttributeInContext(XmlTag tag) {
- if (tag == null) return null;
- String contextName = tag.getName();
-
- for (final HtmlAttributeDescriptor attributeDescriptor : attributes) {
- if (attributeDescriptor.isValidParentTagName(contextName)) {
- return attributeDescriptor;
- }
- }
-
- return null;
- }
-}
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/EntityDescriptor.java b/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/EntityDescriptor.java
deleted file mode 100644
index 21c0b46a2b1a..000000000000
--- a/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/EntityDescriptor.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2000-2009 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.xml.util.documentation;
-
-/**
- * @author maxim
- */
-class EntityDescriptor {
- private String description;
- private String helpRef;
- private String name;
- private char dtd;
-
- static final char LOOSE_DTD = 'L';
- static final char FRAME_DTD = 'D';
-
- char getDtd() {
- return dtd;
- }
-
- void setDtd(char dtd) {
- this.dtd = dtd;
- }
-
- String getDescription() {
- return description;
- }
-
- void setDescription(String description) {
- this.description = description;
- }
-
- String getHelpRef() {
- return helpRef;
- }
-
- void setHelpRef(String helpRef) {
- this.helpRef = helpRef;
- }
-
- String getName() {
- return name;
- }
-
- void setName(String name) {
- this.name = name;
- }
-}
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/HtmlAttributeDescriptor.java b/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/HtmlAttributeDescriptor.java
deleted file mode 100644
index 1cc3e6f73c91..000000000000
--- a/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/HtmlAttributeDescriptor.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2000-2009 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.xml.util.documentation;
-
-import java.util.Arrays;
-
-/**
- * @author maxim
- */
-class HtmlAttributeDescriptor extends EntityDescriptor {
- private String myType;
- private boolean myHasDefaultValue;
- private String[] mySetOfParentTags;
- private boolean myParentSetIsExclusionSet;
-
- boolean isValidParentTagName(String str) {
- boolean containsInSet = Arrays.binarySearch(mySetOfParentTags, str) >= 0;
- return containsInSet == !myParentSetIsExclusionSet;
- }
-
- String getType() {
- return myType;
- }
-
- void setType(String type) {
- this.myType = type;
- }
-
- boolean isHasDefaultValue() {
- return myHasDefaultValue;
- }
-
- void setHasDefaultValue(boolean hasDefaultValue) {
- this.myHasDefaultValue = hasDefaultValue;
- }
-
- String[] getSetOfParentTags() {
- return mySetOfParentTags;
- }
-
- boolean isParentSetIsExclusionSet() {
- return myParentSetIsExclusionSet;
- }
-
- void setParentSetIsExclusionSet(boolean _parentSetIsExclusionSet) {
- myParentSetIsExclusionSet = _parentSetIsExclusionSet;
- }
-
- void setSetOfParentTags(String[] _setOfParentTags) {
- mySetOfParentTags = _setOfParentTags;
- }
-}
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/HtmlDescriptorsTable.java b/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/HtmlDescriptorsTable.java
index 2c7c2192bc87..2ea1f3bafef3 100644
--- a/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/HtmlDescriptorsTable.java
+++ b/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/HtmlDescriptorsTable.java
@@ -1,179 +1,31 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.xml.util.documentation;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.util.JDOMUtil;
-import org.jdom.Element;
-import org.jdom.JDOMException;
-import org.jetbrains.annotations.NonNls;
+import com.intellij.xml.util.Html5TagAndAttributeNamesProvider;
-import java.io.IOException;
-import java.util.*;
+import java.util.Collections;
+import java.util.Locale;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import static com.intellij.util.ObjectUtils.notNull;
/**
- * @author maxim
+ * @deprecated Use {@link Html5TagAndAttributeNamesProvider} instead
*/
+@Deprecated(forRemoval = true)
public final class HtmlDescriptorsTable {
- public static final Logger LOG = Logger.getInstance(HtmlDescriptorsTable.class);
- private static final HashMap ourTagTable = new HashMap<>();
- private static final HashMap ourAttributeTable = new HashMap<>();
-
- @NonNls
- public static final String HTMLTABLE_RESOURCE_NAME = "htmltable.xml";
-
- @NonNls
- public static final String HTML5TABLE_RESOURCE_NAME = "html5table.xml";
-
- @NonNls
- private static final String MATHML_RESOURCE_NAME = "mathmltable.xml";
-
- @NonNls
- private static final String SVG_RESOURCE_NAME = "svgtable.xml";
-
- @NonNls
- public static final String TAG_ELEMENT_NAME = "tag";
-
- @NonNls
- public static final String BASE_HELP_REF_ATTR = "baseHelpRef";
-
- @NonNls
- public static final String NAME_ATTR = "name";
-
- @NonNls
- public static final String HELPREF_ATTR = "helpref";
-
- @NonNls
- public static final String DESCRIPTION_ATTR = "description";
-
- @NonNls public static final String STARTTAG_ATTR = "startTag";
-
- @NonNls public static final String ENDTAG_ATTR = "endTag";
-
- @NonNls public static final String EMPTY_ATTR = "empty";
-
- @NonNls public static final String DTD_ATTR = "dtd";
-
- @NonNls public static final String ATTRIBUTE_ELEMENT_NAME = "attribute";
-
- @NonNls public static final String TYPE_ATTR = "type";
-
- @NonNls public static final String DEFAULT_ATTR = "default";
-
- @NonNls public static final String RELATED_TAGS_ATTR = "relatedTags";
-
- private HtmlDescriptorsTable() {
- }
-
- static {
- try {
- Set htmlTagNames = new HashSet<>();
-
- loadHtmlElements(HTMLTABLE_RESOURCE_NAME, htmlTagNames);
-
- loadHtmlElements(HTML5TABLE_RESOURCE_NAME, htmlTagNames);
-
- loadHtmlElements(MATHML_RESOURCE_NAME, htmlTagNames);
-
- loadHtmlElements(SVG_RESOURCE_NAME, htmlTagNames);
-
- } catch (Exception ex) {
- LOG.error(ex);
- }
- }
-
- private static void loadHtmlElements(final String resourceName, Collection super String> htmlTagNames) throws JDOMException, IOException {
- final Element rootElement = JDOMUtil.load(HtmlDescriptorsTable.class.getResourceAsStream(resourceName));
- final List elements = rootElement.getChildren(TAG_ELEMENT_NAME);
- final String baseHtmlExtDocUrl = rootElement.getAttribute(BASE_HELP_REF_ATTR).getValue();
-
- for (Element element : elements) {
- String htmlTagName = element.getAttributeValue(NAME_ATTR);
- htmlTagNames.add(htmlTagName);
-
- HtmlTagDescriptor value = new HtmlTagDescriptor();
- ourTagTable.put(htmlTagName, value);
- value.setHelpRef(baseHtmlExtDocUrl + element.getAttributeValue(HELPREF_ATTR));
- value.setDescription(element.getAttributeValue(DESCRIPTION_ATTR));
- value.setName(htmlTagName);
-
- value.setHasStartTag(element.getAttribute(STARTTAG_ATTR).getBooleanValue());
- value.setHasEndTag(element.getAttribute(ENDTAG_ATTR).getBooleanValue());
- value.setEmpty(element.getAttribute(EMPTY_ATTR).getBooleanValue());
-
- String attributeValue = element.getAttributeValue(DTD_ATTR);
- if (attributeValue.length() > 0) {
- value.setDtd(attributeValue.charAt(0));
- }
- }
-
- final List attributes = rootElement.getChildren(ATTRIBUTE_ELEMENT_NAME);
- for (Element element : attributes) {
- String attrName = element.getAttributeValue(NAME_ATTR);
-
- HtmlAttributeDescriptor value = new HtmlAttributeDescriptor();
- HtmlAttributeDescriptor previousDescriptor = ourAttributeTable.get(attrName);
-
- if (previousDescriptor == null) {
- ourAttributeTable.put(attrName, value);
- }
- else {
- CompositeAttributeTagDescriptor parentDescriptor;
-
- if (!(previousDescriptor instanceof CompositeAttributeTagDescriptor)) {
- parentDescriptor = new CompositeAttributeTagDescriptor();
- ourAttributeTable.put(attrName, parentDescriptor);
- parentDescriptor.attributes.add(previousDescriptor);
- }
- else {
- parentDescriptor = (CompositeAttributeTagDescriptor)previousDescriptor;
- }
-
- parentDescriptor.attributes.add(value);
- }
-
- value.setHelpRef(baseHtmlExtDocUrl + element.getAttributeValue(HELPREF_ATTR));
- value.setDescription(element.getAttributeValue(DESCRIPTION_ATTR));
- value.setName(attrName);
-
- String attributeValue = element.getAttributeValue(DTD_ATTR);
- if (attributeValue.length() > 0) {
- value.setDtd(attributeValue.charAt(0));
- }
-
- value.setType(element.getAttributeValue(TYPE_ATTR));
- value.setHasDefaultValue(element.getAttribute(DEFAULT_ATTR).getBooleanValue());
-
- StringTokenizer tokenizer = new StringTokenizer(element.getAttributeValue(RELATED_TAGS_ATTR), ",");
- int tokenCount = tokenizer.countTokens();
-
- for (int i = 0; i < tokenCount; ++i) {
- final String s = tokenizer.nextToken();
-
- if (s.equals("!")) {
- value.setParentSetIsExclusionSet(true);
- }
- else {
- if (value.getSetOfParentTags() == null) {
- value.setSetOfParentTags(new String[tokenCount - (value.isParentSetIsExclusionSet() ? 1 : 0)]);
- }
- value.getSetOfParentTags()[i - (value.isParentSetIsExclusionSet() ? 1 : 0)] = s;
- }
- }
-
- Arrays.sort(value.getSetOfParentTags());
- }
- }
-
- public static HtmlTagDescriptor getTagDescriptor(String tagName) {
- return ourTagTable.get(tagName);
- }
-
- public static HtmlAttributeDescriptor getAttributeDescriptor(String attributeName) {
- return ourAttributeTable.get(attributeName);
- }
+ private static final Set knownAttributes = Html5TagAndAttributeNamesProvider.getTags(false)
+ .stream().flatMap(tag -> notNull(Html5TagAndAttributeNamesProvider.getTagAttributes(tag, false), Collections.emptySet()).stream())
+ .map(attr -> attr.toString())
+ .collect(Collectors.toSet());
+ /**
+ * @deprecated Use {@link Html5TagAndAttributeNamesProvider} instead
+ */
+ @Deprecated(forRemoval = true)
public static boolean isKnownAttributeDescriptor(String attributeName) {
- return getAttributeDescriptor(attributeName) != null;
+ return knownAttributes.contains(attributeName.toLowerCase(Locale.US));
}
}
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/HtmlTagDescriptor.java b/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/HtmlTagDescriptor.java
deleted file mode 100644
index ae0d8b4e71dc..000000000000
--- a/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/HtmlTagDescriptor.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2000-2009 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.xml.util.documentation;
-
-/**
- * @author maxim
- */
-class HtmlTagDescriptor extends EntityDescriptor {
- boolean isHasStartTag() {
- return hasStartTag;
- }
-
- void setHasStartTag(boolean hasStartTag) {
- this.hasStartTag = hasStartTag;
- }
-
- boolean isHasEndTag() {
- return hasEndTag;
- }
-
- void setHasEndTag(boolean hasEndTag) {
- this.hasEndTag = hasEndTag;
- }
-
- boolean isEmpty() {
- return empty;
- }
-
- void setEmpty(boolean empty) {
- this.empty = empty;
- }
-
- private boolean hasStartTag;
- private boolean hasEndTag;
- private boolean empty;
-}
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/html5table.xml b/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/html5table.xml
deleted file mode 100644
index 087303858fe3..000000000000
--- a/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/html5table.xml
+++ /dev/null
@@ -1,1330 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/htmltable.xml b/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/htmltable.xml
deleted file mode 100644
index 6a76727cd83e..000000000000
--- a/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/htmltable.xml
+++ /dev/null
@@ -1,2234 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/mathmltable.xml b/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/mathmltable.xml
deleted file mode 100644
index 6e659ccbcd3d..000000000000
--- a/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/mathmltable.xml
+++ /dev/null
@@ -1,210 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/svgtable.xml b/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/svgtable.xml
deleted file mode 100644
index 478a2b2bac79..000000000000
--- a/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/svgtable.xml
+++ /dev/null
@@ -1,634 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file