@haxall/haxall
    Preparing search index...

    Class Style

    Style models CSS style properties for an Elem.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    type$: Type

    Methods

    • Add the given CSS class name to this element. If this element already contains the given class name, then this method does nothing. Returns this.

      Parameters

      • name: string

      Returns this

    • Add a psuedo-class CSS definietion to this element. A new class name is auto-generated and used to prefix name, name must start with the : character. Returns the generated class name.

      style.addPseudoClass(":hover", "background: #eee")
      

      Parameters

      • name: string
      • css: string

      Returns string

    • The CSS classes for this element.

      Returns List<string>

    • The CSS classes for this element.

      Parameters

      Returns void

    • Clear all style declarations.

      Returns this

    • Return a negative integer, zero, or a positive integer if this object is less than, equal to, or greater than the specified object:

      this < that   =>  <0
      this == that => 0
      this > that => >0

      This method may also be accessed via the < <= <=> >= and > shortcut operators. If not overridden the default implementation compares the toStr representations. Also see docLang.

      Examples:

      3.compare(8)  =>  -1
      8.compare(3) => 1
      8.compare(8) => 0
      3 <=> 8 => -1 // shortcut for 3.compare(8)

      Parameters

      Returns number

    • Get the computed property value.

      Parameters

      • name: string

      Returns JsObj

    • Get the effetive style property value, which is the most specific style or CSS rule in effect on this node. Returns null if no rule in effect for given property.

      This method is restricted to stylesheets that have originated from the same domain as the document. Any rules that may be applied from an external sheet will not be included.

      Parameters

      • name: string

      Returns JsObj

    • Compare this object to the specified for equality. This method may be accessed via the == and != shortcut operators. If not overridden the default implementation compares for reference equality using the === operator. If this method is overridden, then hash() must also be overridden such that any two objects which return true for equals() must return the same value for hash(). This method must accept null and return false.

      Parameters

      Returns boolean

    • Get the given property value.

      color := style["color"]
      

      Parameters

      • name: string

      Returns JsObj

    • Return true if this element has the given CSS class name, or false if it does not.

      Parameters

      • name: string

      Returns boolean

    • Return a unique hashcode for this object. If a class overrides hash() then it must ensure if equals() returns true for any two objects then they have same hash code.

      Returns number

    • Return if this Obj is immutable and safe to share between threads:

      • an instance of a const class
      • the result of toImmutable on List, Map, or Buf
      • a Func object may or may not be immutable - see sys::Func.
      • other instances are assumed mutable and return false

      Returns boolean

    • Remove the given CSS class name to this element. If this element does not have the given class name, this method does nothing. Returns this.

      Parameters

      • name: string

      Returns this

    • Set the given propery value. If val is null this property is removed.

      style["color"] = "#f00"
      

      Parameters

      Returns this

    • Set all the given property values.

      style.setAll(["color":"#f00", "font-weight":"bold"])
      

      Parameters

      Returns this

    • Set properties via CSS text.

      style.setCss("color: #f00; font-weight: bold;")
      

      Parameters

      • css: string

      Returns this

    • Toggle the presence of the given CSS class name based on the cond argument:

      • null: remove class if present, or add if missing
      • true: always add class (see addClass)
      • false: always remove class(see removeClass)

      Parameters

      • name: string
      • Optionalcond: boolean

      Returns this

    • Get an immutable representation of this instance or throw NotImmutableErr if this object cannot be represented as an immutable:

      • if type is const, return this
      • if already an immutable List, Map, Buf, or Func return this
      • if a List, then attempt to perform a deep clone by calling toImmutable on all items
      • if a Map, then attempt to perform a deep clone by calling toImmutable on all values (keys are already immutable)
      • some Funcs can be made immutable - see sys::Func
      • if a Buf create immutable copy, see sys::Buf
      • any other object throws NotImmutableErr

      Returns Readonly<this>

    • Return a string representation of this object.

      Returns string

    • Get or set an attribute. Attribute names should be specifed in camel case:

      style->backgroundColor == style["background-color"]
      

      Parameters

      Returns JsObj

    • Get the Type instance which represents this object's class. Also seeType.of or Pod.of.

      Returns Type

    • This method called whenever an it-block is applied to an object. The default implementation calls the function with this, and then returns this.

      Parameters

      • f: (arg0: this) => void

      Returns this

    • Write x.toStr to standard output followed by newline. If x is null then print "null". If no argument is provided then print an empty line.

      Parameters

      Returns void