Class HTMLUtils


  • public final class HTMLUtils
    extends java.lang.Object
    Utilities for HTML-specific logic.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private HTMLUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean isCaseInsensitiveAttribute​(java.lang.String namespace, java.lang.String name)
      Returns whether an attribute is defined as having a case-insensitive value in HTML.
      static boolean isCustomElement​(java.lang.String namespace, java.lang.String name)  
      static boolean isCustomNamespace​(java.lang.String namespace)  
      static boolean isDataAttribute​(java.lang.String namespace, java.lang.String name)  
      static boolean isValidDataAttribute​(java.lang.String name)
      Tells if a string is a valid custom data attribute, as defined in HTML.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • KNOWN_XHTML_NAMESPACES

        private static final java.util.Set<java.lang.String> KNOWN_XHTML_NAMESPACES
      • CASE_INSENSITIVE_ATTRIBUTES

        private static final java.util.Set<java.lang.String> CASE_INSENSITIVE_ATTRIBUTES
    • Constructor Detail

      • HTMLUtils

        private HTMLUtils()
    • Method Detail

      • isCustomElement

        public static boolean isCustomElement​(java.lang.String namespace,
                                              java.lang.String name)
      • isCustomNamespace

        public static boolean isCustomNamespace​(java.lang.String namespace)
      • isCaseInsensitiveAttribute

        public static boolean isCaseInsensitiveAttribute​(java.lang.String namespace,
                                                         java.lang.String name)
        Returns whether an attribute is defined as having a case-insensitive value in HTML. This is notably the case of boolean attributes and enumerated attributes.
        Parameters:
        name - the name of an attribute defined in the HTML specification
        Returns:
        true iff the attribute value is case-insensitive
      • isDataAttribute

        public static boolean isDataAttribute​(java.lang.String namespace,
                                              java.lang.String name)
      • isValidDataAttribute

        public static boolean isValidDataAttribute​(java.lang.String name)
        Tells if a string is a valid custom data attribute, as defined in HTML.
        Parameters:
        name - the data attribute to test
        Returns:
        true if name is a valid custom data attribute