Class Property


  • public final class Property
    extends java.lang.Object
    An object that represents a CSS property. Although this class contains a large set of built-in properties (see allRecognizedProperties()), it is a class rather than an enum so that it is possible to create properties that are not built-in. User agents will likely add support for new properties faster than we can add them to this list.
    • Method Detail

      • byName

        public static Property byName​(java.lang.String name)
        Returns:
        a Property with the specified name. If name corresponds to a recognized property, then the corresponding Property will be returned; otherwise, a new Property with the specified name will be created.
      • getName

        public java.lang.String getName()
        Returns:
        the name of this CSS property as it appears in a stylesheet, such as "z-index"
      • isRecognizedProperty

        public boolean isRecognizedProperty()
        Returns:
        whether this Property is recognized by default by the CSS Compiler. Note that this is not the same as a being a "standard" CSS property because the CSS Compiler recognizes non-standard CSS properties such as "-webkit-border-radius", among others.
      • getShorthands

        public java.util.Set<java.lang.String> getShorthands()
        Returns the set of shorthand properties related to this property, or the empty set if this property is not standard.

        For example, border-left-style has border, border-left and border-style as shorthands.

      • getPartition

        public java.lang.String getPartition()
        Gets the partition of this property. All properties with the same partition share a common shorthand. A non-standard property is its own single partition.

        For example, padding, padding-bottom, padding-left, padding-right, padding-top are all in the padding partition. As another example, z-index is its own single partition.

        Returns:
        a string representing the partition
      • isVendorSpecific

        public boolean isVendorSpecific()
        Returns:
        whether this Property is a vendor-specific CSS property, such as "-webkit-border-radius"
      • hasPositionalParameters

        public boolean hasPositionalParameters()
        Returns:
        whether this property can take positional parameters, such as "margin", where the parameters "1px 2px 3px" imply "1px 2px 3px 2px"
      • isCustom

        public boolean isCustom()
        Returns:
        whether this is a CSS custom property
      • isSvgOnly

        public boolean isSvgOnly()
      • hasWarning

        public boolean hasWarning()
      • getWarning

        public java.lang.String getWarning()
      • allRecognizedPropertyNames

        public static java.util.Set<java.lang.String> allRecognizedPropertyNames()
        Returns:
        an immutable set of CSS properties recognized by default by the CSS Compiler
      • allRecognizedProperties

        public static java.util.Set<Property> allRecognizedProperties()
        Returns:
        an immutable set of Property instances recognized by default by the CSS Compiler