boolean (@NotNull XmlTag tag) { XmlTag parent = tag; while (parent != null) { if ("svg".equals(parent.getName()) || "math".equals(parent.getName())) { return true; } parent = parent.getParentTag(); } return super.isSelfClosingTagAllowed(tag); }