private static boolean isAcceptableAttributeValue(PsiElement element) {
    final PsiElement parent = element.getParent();

    if (parent instanceof XmlAttribute xmlAttribute) {
      final @NonNls String attrName = xmlAttribute.getName();
      XmlTag tag = xmlAttribute.getParent();
      if (tag == null) return false;

      final @NonNls String tagName = tag.getName();

      return
       ( attrName.equalsIgnoreCase(SRC_ATTR_NAME) &&
         (tagName.equalsIgnoreCase(SizeReference.IMAGE_TAG_NAME) ||
          tagName.equalsIgnoreCase(HtmlUtil.SCRIPT_TAG_NAME) ||
          tagName.equalsIgnoreCase("frame") ||
          tagName.equalsIgnoreCase("iframe") ||
          tagName.equalsIgnoreCase("video") ||
          tagName.equalsIgnoreCase("audio") ||
          tagName.equalsIgnoreCase("track") ||
          tagName.equalsIgnoreCase("source") ||
          tagName.equalsIgnoreCase("embed") ||
          tagName.equalsIgnoreCase("input") &&
          tag.getAttributeValue("type") != null &&
          "image".equalsIgnoreCase(tag.getAttributeValue("type"))
         )
        ) ||
         ( attrName.equalsIgnoreCase(HREF_ATTRIBUTE_NAME) &&
           ( tagName.equalsIgnoreCase("a") ||
             tagName.equalsIgnoreCase("area") ||
             StringUtil.endsWithIgnoreCase(tagName, "link")
         )
         ) ||
         (attrName.equalsIgnoreCase("to") && StringUtil.endsWithIgnoreCase(tagName, "link")
         ) ||
           ( attrName.equalsIgnoreCase(USEMAP_ATTR_NAME) &&
         (tagName.equalsIgnoreCase(SizeReference.IMAGE_TAG_NAME) ||
          tagName.equalsIgnoreCase("object"))
        ) ||
           ( attrName.equalsIgnoreCase("action") &&
         tagName.equalsIgnoreCase("form")
        ) ||
        attrName.equalsIgnoreCase("background") ||
             ( ( attrName.equalsIgnoreCase(NAME_ATTR_LOCAL_NAME) ||
          attrName.equalsIgnoreCase(HtmlUtil.ID_ATTRIBUTE_NAME) ||
          attrName.equalsIgnoreCase(HtmlUtil.CLASS_ATTRIBUTE_NAME)
         ) &&
         tag.getNamespacePrefix().length() == 0
        ) ||
               ( (attrName.equalsIgnoreCase(SizeReference.WIDTH_ATTR_NAME) ||
          attrName.equalsIgnoreCase(SizeReference.HEIGHT_ATTR_NAME)
         ) &&
         (tagName.equalsIgnoreCase(SizeReference.IMAGE_TAG_NAME))
        ) ||
        (attrName.equalsIgnoreCase(ContentTypeReference.TYPE_ATTR_NAME) &&
         (tagName.equalsIgnoreCase(HtmlUtil.STYLE_TAG_NAME) ||
          tagName.equalsIgnoreCase(HtmlUtil.SCRIPT_TAG_NAME)
         )
        ) ||
        (attrName.equalsIgnoreCase(ColorReference.BG_COLOR_ATTR_NAME) &&
         ColorReference.ourBgColorTagNames.contains(StringUtil.toLowerCase(tagName))
        ) ||
                    ( attrName.equalsIgnoreCase(ColorReference.COLOR_ATTR_NAME) &&
         (tagName.equalsIgnoreCase("basefont") ||
          tagName.equalsIgnoreCase("font")
         )
        ) ||
                    ( tagName.equalsIgnoreCase("body") &&
         (attrName.equalsIgnoreCase(ColorReference.TEXT_ATTR_NAME) ||
          attrName.equalsIgnoreCase(ColorReference.LINK_ATTR_NAME) ||
          attrName.equalsIgnoreCase(ColorReference.VLINK_ATTR_NAME) ||
          attrName.equalsIgnoreCase(ColorReference.ALINK_ATTR_NAME)
         )
        ) ||
        (tagName.equalsIgnoreCase("label") &&
         attrName.equalsIgnoreCase(FOR_ATTR_NAME)
        ) ||
        (attrName.equalsIgnoreCase(MicrodataUtil.ITEM_REF) &&
         tag.getAttribute(MicrodataUtil.ITEM_SCOPE) != null
        ) ||
        (attrName.equalsIgnoreCase("data") &&
         tagName.equalsIgnoreCase("object")
                    )||
        (attrName.equalsIgnoreCase("poster") &&
         tagName.equalsIgnoreCase("video")
                    )||
        (attrName.equalsIgnoreCase("srcset") &&
         (tagName.equalsIgnoreCase(SizeReference.IMAGE_TAG_NAME) || tagName.equals("source"))
                    )||
        (attrName.equalsIgnoreCase(LABELLEDBY))
        ;
    }
    return false;
  }
private static boolean isAcceptableAttributeValue(PsiElement element)